public void SimpleCase() { String contents = "import Castle.Facilities.AspectSharp.Tests.Components in Castle.Facilities.AspectSharp.Tests " + "import Castle.Facilities.AspectSharp.Tests.Interceptors in Castle.Facilities.AspectSharp.Tests " + " " + " aspect MyAspect for SimpleService " + " " + " pointcut method|property(*)" + " advice(LoggerInterceptor)" + " end" + " " + " end "; MutableConfiguration config = new MutableConfiguration("facility", contents); DefaultConfigurationStore store = new DefaultConfigurationStore(); store.AddFacilityConfiguration("aop", config); WindsorContainer container = new WindsorContainer(store); container.AddFacility("aop", new AspectSharpFacility()); container.AddComponent("comp1", typeof(SimpleService)); SimpleService service = container[typeof(SimpleService)] as SimpleService; service.DoSomething(); service.DoSomethingElse(); Assert.AreEqual("Enter DoSomething\r\nEnter DoSomethingElse\r\n", LoggerInterceptor.Messages.ToString()); }
public void TestGenericServiceEvent() { SimpleService service = new SimpleService(); service.OnServiceEvent += new GenericServiceEventHandler(OnGenericServiceEvent); service.DoSomething(); }