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