Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27969
Modified Files:
ExceptionHandlerAspectIntegrationTests.cs
Log Message:
SPRNET-742 - Exception handling aspect supports using SpEL expression as filtering condition as alternative to use of exception name.
Index: ExceptionHandlerAspectIntegrationTests.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ExceptionHandlerAspectIntegrationTests.cs 9 Aug 2007 04:03:07 -0000 1.3
--- ExceptionHandlerAspectIntegrationTests.cs 2 Oct 2007 21:57:08 -0000 1.4
***************
*** 61,65 ****
string testText = @"#log.Debug('Hello World, exception message = ' + #e.Message + ', target method = ' + #method.Name)";
logHandler.SourceExceptionNames.Add("ArithmeticException");
! logHandler.ExpressionText = testText;
exceptionHandlerAdvice.ExceptionHandlers.Add(logHandler);
--- 61,65 ----
string testText = @"#log.Debug('Hello World, exception message = ' + #e.Message + ', target method = ' + #method.Name)";
logHandler.SourceExceptionNames.Add("ArithmeticException");
! logHandler.ActionExpressionText = testText;
exceptionHandlerAdvice.ExceptionHandlers.Add(logHandler);
***************
*** 83,88 ****
public void LoggingTestWithString()
{
! string logHandlerText = "on ArithmeticException log 'My Message, Method Name ' + #method.Name";
ITestObject to = CreateTestObjectProxy(logHandlerText);
--- 83,102 ----
public void LoggingTestWithString()
{
! string logHandlerText = "on exception name ArithmeticException log 'My Message, Method Name ' + #method.Name";
!
! ExecuteLoggingHandler(logHandlerText);
! }
!
!
! [Test]
! public void LoggingTestWithConstraintExpression()
! {
! string logHandlerText = "on exception (#e is T(System.ArithmeticException)) log 'My Message, Method Name ' + #method.Name";
+ ExecuteLoggingHandler(logHandlerText);
+ }
+
+ private void ExecuteLoggingHandler(string logHandlerText)
+ {
ITestObject to = CreateTestObjectProxy(logHandlerText);
***************
*** 90,94 ****
{
to.Exceptional(new ArithmeticException());
! } catch (ArithmeticException)
{
//TODO assert logging occured.
--- 104,109 ----
{
to.Exceptional(new ArithmeticException());
! }
! catch (ArithmeticException)
{
//TODO assert logging occured.
***************
*** 102,106 ****
{
string translationHandlerText =
! "on ArithmeticException translate new System.InvalidOperationException('My Message, Method Name ' + #method.Name, #e)";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
--- 117,121 ----
{
string translationHandlerText =
! "on exception name ArithmeticException translate new System.InvalidOperationException('My Message, Method Name ' + #method.Name, #e)";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
***************
*** 118,122 ****
Assert.IsInstanceOfType(typeof(InvalidOperationException), e, "wrong exception type thrown.");
}
-
}
--- 133,136 ----
***************
*** 125,129 ****
{
string translationHandlerText =
! "on ArithmeticException wrap System.InvalidOperationException 'My Message'";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
--- 139,143 ----
{
string translationHandlerText =
! "on exception name ArithmeticException wrap System.InvalidOperationException 'My Message'";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
***************
*** 148,152 ****
{
string translationHandlerText =
! "on ArithmeticException wrap System.InvalidOperationException";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
--- 162,166 ----
{
string translationHandlerText =
! "on exception name ArithmeticException wrap System.InvalidOperationException";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
***************
*** 172,176 ****
{
string translationHandlerText =
! "on ArithmeticException replace System.InvalidOperationException 'My Message'";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
--- 186,190 ----
{
string translationHandlerText =
! "on exception name ArithmeticException replace System.InvalidOperationException 'My Message'";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
***************
*** 195,199 ****
{
string translationHandlerText =
! "on ArithmeticException replace System.InvalidOperationException";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
--- 209,213 ----
{
string translationHandlerText =
! "on exception name ArithmeticException replace System.InvalidOperationException";
ITestObject to = CreateTestObjectProxy(translationHandlerText);
***************
*** 217,221 ****
public void SwallowWithString()
{
! string returnHandlerText = "on ArithmeticException swallow";
ITestObject to = CreateTestObjectProxy(returnHandlerText);
try
--- 231,235 ----
public void SwallowWithString()
{
! string returnHandlerText = "on exception name ArithmeticException swallow";
ITestObject to = CreateTestObjectProxy(returnHandlerText);
try
***************
*** 232,236 ****
public void ReturnWithString()
{
! string returnHandlerText = "on ArithmeticException return 12";
ITestObject to = CreateTestObjectProxy(returnHandlerText);
try
--- 246,250 ----
public void ReturnWithString()
{
! string returnHandlerText = "on exception name ArithmeticException return 12";
ITestObject to = CreateTestObjectProxy(returnHandlerText);
try
|