public void SetUp() { string directory = PrepareDirectory(); DynamicMixinBuilder.Scope = new ModuleScope(true, false, "DynamicMixinBuilder.Signed", Path.Combine(directory, "DynamicMixinBuilder.Signed.dll"), "DynamicMixinBuilder.Unsigned", Path.Combine(directory, "DynamicMixinBuilder.Unsigned.dll")); // Set new default pipeline to avoid cached types to influence each other. ResetDefaultPipeline(); _invocationHandler = delegate(object instance, MethodInfo method, object[] args, BaseMethodInvoker baseMethod) { object result = baseMethod(args); _calls.Add(Tuple.Create(instance, method, args, result)); return("Intercepted: " + result); }; _calls.Clear(); _builder = new DynamicMixinBuilder(typeof(SampleTarget)); }
public void BuildMixinType_CreatesTypeDerivedFromMixin() { Type t = new DynamicMixinBuilder(typeof(object)).BuildMixinType(_invocationHandler); Assert.That(Reflection.TypeExtensions.CanAscribeTo(t, typeof(Mixin <,>)), Is.True); }
public void BuildMixinType_CreatesType() { Type t = new DynamicMixinBuilder(typeof(object)).BuildMixinType(_invocationHandler); Assert.That(t, Is.Not.Null); }