public void CoordinatorDeclarativeWithAttributes() { ITestCoord coord = ctx["testCoordinator"] as ITestCoord; Assert.IsNotNull(coord); CallCountingTransactionManager ccm = ctx["transactionManager"] as CallCountingTransactionManager; Assert.IsNotNull(ccm); LoggingAroundAdvice advice = (LoggingAroundAdvice)ctx["consoleLoggingAroundAdvice"]; Assert.IsNotNull(advice); ITestObjectMgr testObjectMgr = ctx["testObjectManager"] as ITestObjectMgr; Assert.IsNotNull(testObjectMgr); //Proxied due to NameMatchMethodPointcutAdvisor Assert.IsTrue(AopUtils.IsAopProxy(coord)); //Proxied due to DefaultAdvisorAutoProxyCreator Assert.IsTrue(AopUtils.IsAopProxy(testObjectMgr)); TestObject to1 = new TestObject("Jack", 7); TestObject to2 = new TestObject("Jill", 6); Assert.AreEqual(0, ccm.begun); Assert.AreEqual(0, ccm.commits); Assert.AreEqual(0, advice.numInvoked); coord.WorkOn(to1, to2); Assert.AreEqual(1, ccm.begun); Assert.AreEqual(1, ccm.commits); Assert.AreEqual(1, advice.numInvoked); }
public void CopyAttributes() { IPlatformTransactionManager ptm = PlatformTxManagerForNewTransaction(); AttributesTransactionAttributeSource tas = new AttributesTransactionAttributeSource(); TestObjectMgr to = new TestObjectMgr(); ITestObjectMgr ito = (ITestObjectMgr)Advised(to, ptm, tas); ito.DeleteTwoTestObjects("foo", "bar"); }