mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing functional tests execution
On .NET 4.6
This commit is contained in:
@@ -93,13 +93,14 @@ namespace Orchard.Specs.Bindings {
|
|||||||
_webHost = new WebHost(_orchardTemp);
|
_webHost = new WebHost(_orchardTemp);
|
||||||
Host.Initialize(siteFolder, virtualDirectory ?? "/", _dynamicCompilationOption);
|
Host.Initialize(siteFolder, virtualDirectory ?? "/", _dynamicCompilationOption);
|
||||||
var shuttle = new Shuttle();
|
var shuttle = new Shuttle();
|
||||||
Host.Execute(() => {
|
Host.Execute(() => Executor(shuttle));
|
||||||
log4net.Config.BasicConfigurator.Configure(new CastleAppender());
|
|
||||||
HostingTraceListener.SetHook(msg => shuttle._sink.Receive(msg));
|
|
||||||
});
|
|
||||||
_messages = shuttle._sink;
|
_messages = shuttle._sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void Executor(Shuttle shuttle) {
|
||||||
|
HostingTraceListener.SetHook(msg => shuttle._sink.Receive(msg));
|
||||||
|
}
|
||||||
|
|
||||||
private class CastleAppender : IAppender {
|
private class CastleAppender : IAppender {
|
||||||
public void Close() { }
|
public void Close() { }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
@@ -68,7 +68,7 @@ namespace Orchard.Specs.Hosting {
|
|||||||
TargetInstance = Activator.CreateInstance(classType);
|
TargetInstance = Activator.CreateInstance(classType);
|
||||||
|
|
||||||
foreach (FieldInfo field in classType.GetFields()) {
|
foreach (FieldInfo field in classType.GetFields()) {
|
||||||
if (typeof (Delegate).IsAssignableFrom(field.FieldType))
|
if (typeof (TDelegate).IsAssignableFrom(field.FieldType))
|
||||||
//If the field is a delegate
|
//If the field is a delegate
|
||||||
field.SetValue(TargetInstance, ((SerializableDelegate<TDelegate>)info.GetValue(field.Name, typeof(SerializableDelegate<TDelegate>))).Delegate);
|
field.SetValue(TargetInstance, ((SerializableDelegate<TDelegate>)info.GetValue(field.Name, typeof(SerializableDelegate<TDelegate>))).Delegate);
|
||||||
else if (!field.FieldType.IsSerializable)
|
else if (!field.FieldType.IsSerializable)
|
||||||
@@ -86,8 +86,12 @@ namespace Orchard.Specs.Hosting {
|
|||||||
|
|
||||||
foreach (FieldInfo field in targetType.GetFields()) {
|
foreach (FieldInfo field in targetType.GetFields()) {
|
||||||
//See corresponding comments above
|
//See corresponding comments above
|
||||||
if (typeof (Delegate).IsAssignableFrom(field.FieldType))
|
if (typeof (TDelegate).IsAssignableFrom(field.FieldType)) {
|
||||||
info.AddValue(field.Name, new SerializableDelegate<TDelegate>((TDelegate)field.GetValue(TargetInstance)));
|
var value = (TDelegate)field.GetValue(TargetInstance);
|
||||||
|
if (value != null) {
|
||||||
|
info.AddValue(field.Name, new SerializableDelegate<TDelegate>(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!field.FieldType.IsSerializable)
|
else if (!field.FieldType.IsSerializable)
|
||||||
info.AddValue(field.Name, new AnonymousClassWrapper(field.FieldType, field.GetValue(TargetInstance)));
|
info.AddValue(field.Name, new AnonymousClassWrapper(field.FieldType, field.GetValue(TargetInstance)));
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user