public void ProxyDataAccessAndServiceLayer() { Assert.IsFalse(AopUtils.IsAopProxy(ctx["DbProvider"])); Assert.IsFalse(AopUtils.IsAopProxy(ctx["SessionFactory"])); Assert.IsFalse(AopUtils.IsAopProxy(ctx["hibernateTransactionManager"])); Assert.IsFalse(AopUtils.IsAopProxy(ctx["transactionManager"])); //Assert.IsTrue(AopUtils.IsAopProxy(ctx["testObjectDaoTransProxy"])); Assert.IsTrue(AopUtils.IsAopProxy(ctx["TestObjectDao"])); Assert.IsTrue(AopUtils.IsAopProxy(ctx["SimpleService"])); CallCountingTransactionManager ccm = ctx["transactionManager"] as CallCountingTransactionManager; Assert.IsNotNull(ccm); Assert.AreEqual(0, ccm.begun); Assert.AreEqual(0, ccm.commits); LoggingAroundAdvice caa = ctx["loggingAroundAdvice"] as LoggingAroundAdvice; Assert.IsNotNull(caa); Assert.AreEqual(0, caa.numInvoked); ISimpleService simpleService = ctx["SimpleService"] as ISimpleService; Assert.IsNotNull(simpleService); simpleService.DoWork(new TestObject()); Assert.AreEqual(1, ccm.begun); Assert.AreEqual(1, ccm.commits); Assert.AreEqual(1, caa.numInvoked); }
public Task Handle(ReceiveContext <SimpleCommand> context) { _service.DoWork(); Console.WriteLine(context.Message.Id); return(Task.FromResult(0)); }