public void TestMultiplePointCut() { //Create and mock the interceptor. MockRepository mock = new MockRepository(); IAspect hmock = mock.CreateMock <IAspect>(); Expect.Call(hmock.PreCall(null)) .Repeat.Twice() .Return(MethodVoteOptions.Continue) .IgnoreArguments(); Expect.Call(() => hmock.PostCall(null, null)) .Repeat.Twice() .IgnoreArguments(); mock.ReplayAll(); using (TestContainer container = new TestContainer(@"Concrete\Castle\AOP\TestSuite1\Configs\ConfigSample3.config")) { //Set the mock into the kernel. container.Kernel.RemoveComponent("interceptor"); container.Kernel.AddComponentInstance("interceptor", hmock); ISomething something = container.Resolve <ISomething>(); something.AMethod("TEST"); something.OtherMethod("1", "2"); } mock.VerifyAll(); }
public void TestBasicInterception() { using (IWindsorContainer container = new WindsorContainer(@"Concrete\Castle\AOP\TestSuite1\Configs\ConfigSample1.config")) { ISomething someth = container.Resolve <ISomething>(); someth.AMethod("Test"); someth.OtherMethod("Test", "otherTEst"); } }