Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28981
Modified Files:
ExceptionHandlerAspectIntegrationTests.cs
Log Message:
SPRNET-880 - Logging exception handler should continue processing of exception handler chain.
Index: ExceptionHandlerAspectIntegrationTests.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ExceptionHandlerAspectIntegrationTests.cs 8 Oct 2007 22:05:26 -0000 1.5
--- ExceptionHandlerAspectIntegrationTests.cs 26 Feb 2008 00:03:43 -0000 1.6
***************
*** 292,296 ****
--- 292,325 ----
}
+ [Test]
+ public void ChainLogAndWrap()
+ {
+ string logHandlerText = "on exception name ArithmeticException log 'My Message, Method Name ' + #method.Name";
+ string translationHandlerText = "on exception name ArithmeticException wrap System.InvalidOperationException 'My Message'";
+ exceptionHandlerAdvice.ExceptionHandlers.Add(logHandlerText);
+ exceptionHandlerAdvice.ExceptionHandlers.Add(translationHandlerText);
+ exceptionHandlerAdvice.AfterPropertiesSet();
+ ProxyFactory pf = new ProxyFactory(new TestObject());
+ pf.AddAdvice(exceptionHandlerAdvice);
+ ITestObject to = (ITestObject)pf.GetProxy();
+ try
+ {
+ to.Exceptional(new ArithmeticException("Bad Math"));
+ Assert.Fail("Should have thrown exception");
+ }
+ catch (InvalidOperationException e)
+ {
+ Assert.IsNotNull(e.InnerException);
+ Exception innerEx = e.InnerException;
+ Assert.AreEqual("My Message", e.Message);
+ Assert.AreEqual("Bad Math", innerEx.Message);
+ }
+ catch (Exception e)
+ {
+ Assert.IsInstanceOfType(typeof(InvalidOperationException), e);
+ }
+
+ }
private ITestObject CreateTestObjectProxy(string logHandlerText)
|