public void ShouldOverrideVirtualMethodsWithReturnTypesWithServiceLocatorMultipleEncapsulation() { locator = new ThreadedServiceLocator(new NinjectAdapter.NinjectAdapter()); locator.Register(Given <SampleEncapsulatingAttribute> .Then <SampleEncapsulatingAttribute>()); locator.Register(Given <SamplePreProcessingAttribute> .Then <SamplePreProcessingAttribute>()); locator.Register(Given <SamplePostProcessingAttribute> .Then <SamplePostProcessingAttribute>()); Type type = new SiegeProxy().WithServiceLocator().Create <TestType2>(); var instance = Activator.CreateInstance(type, locator); Assert.AreEqual("lolarg1", type.GetMethod("Test").Invoke(instance, new[] { "arg1", "arg2" })); Assert.AreEqual(3, Counter.Count); }
public void ShouldOverrideVirtualMethodsWithReturnTypesWithoutServiceLocator() { locator = new ThreadedServiceLocator(new NinjectAdapter.NinjectAdapter()); locator.Register(Given<SampleEncapsulatingAttribute>.Then<SampleEncapsulatingAttribute>()); locator.Register(Given<SamplePreProcessingAttribute>.Then<SamplePreProcessingAttribute>()); locator.Register(Given<SamplePostProcessingAttribute>.Then<SamplePostProcessingAttribute>()); Type type = new SiegeProxy().Create<TestType>(); var instance = Activator.CreateInstance(type); Assert.AreEqual("lolarg1", type.GetMethod("Test").Invoke(instance, new[] { "arg1", "arg2" })); Assert.AreEqual(1, Counter.Count); }
public ProxyRegistration(SiegeProxy proxy) { this.proxy = proxy; }
public SiegeProxyTypeBuilder(IServiceLocator serviceLocator) { proxy = new SiegeProxy().WithServiceLocator(); }