Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Transaction/Interceptor
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15159
Modified Files:
RollbackRuleAttributeTests.cs
Log Message:
SPRNET-905 - RollbackRuleAttribute checks for null Type and null or empty string in constructor
Index: RollbackRuleAttributeTests.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Transaction/Interceptor/RollbackRuleAttributeTests.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RollbackRuleAttributeTests.cs 17 May 2006 17:48:28 -0000 1.3
--- RollbackRuleAttributeTests.cs 31 Mar 2008 20:09:40 -0000 1.4
***************
*** 1,2 ****
--- 1,23 ----
+ #region License
+
+ /*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ #endregion
+
+
using System;
using System.Data;
***************
*** 7,58 ****
namespace Spring.Transaction.Interceptor
{
! [TestFixture]
! public class RollbackRuleAttributeTests
! {
! [Test]
! public void FoundImmediatelyWithString()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Exception");
! Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
! }
! [Test]
! public void FoundImmediatelyWithClass()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute(typeof(Exception));
! Assert.IsTrue(rr.GetDepth(new Exception()) == 0);
! }
! [Test]
! public void FoundImmediatelyWithType()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute(typeof(Exception));
! Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
! }
! [Test]
! public void NotFound()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Data.DataException");
! Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) == -1);
! }
! [Test]
! public void Ancestry()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Exception");
! Assert.IsTrue(rr.GetDepth(typeof(DataException)) == 2);
! }
! [Test]
! public void AlwaysTrue()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Exception");
! Assert.IsTrue(rr.GetDepth(typeof(SystemException)) > 0);
! Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) > 0);
! Assert.IsTrue(rr.GetDepth(typeof(DataException)) > 0);
! Assert.IsTrue(rr.GetDepth(typeof(TransactionSystemException)) > 0);
! }
! [Test]
! [ExpectedException(typeof(AopConfigException))]
! public void ConstructorArgMustBeAExceptionClass()
! {
! new RollbackRuleAttribute( typeof( StringBuilder ) );
! }
! }
! }
--- 28,101 ----
namespace Spring.Transaction.Interceptor
{
! [TestFixture]
! public class RollbackRuleAttributeTests
! {
! [Test]
! public void FoundImmediatelyWithString()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Exception");
! Assert.IsTrue(rr.GetDepth(typeof (Exception)) == 0);
! }
!
! [Test]
! public void FoundImmediatelyWithClass()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute(typeof (Exception));
! Assert.IsTrue(rr.GetDepth(new Exception()) == 0);
! }
!
! [Test]
! public void FoundImmediatelyWithType()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute(typeof (Exception));
! Assert.IsTrue(rr.GetDepth(typeof (Exception)) == 0);
! }
!
! [Test]
! public void NotFound()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Data.DataException");
! Assert.IsTrue(rr.GetDepth(typeof (ApplicationException)) == -1);
! }
!
! [Test]
! public void Ancestry()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Exception");
! Assert.IsTrue(rr.GetDepth(typeof (DataException)) == 2);
! }
!
! [Test]
! public void AlwaysTrue()
! {
! RollbackRuleAttribute rr = new RollbackRuleAttribute("System.Exception");
! Assert.IsTrue(rr.GetDepth(typeof (SystemException)) > 0);
! Assert.IsTrue(rr.GetDepth(typeof (ApplicationException)) > 0);
! Assert.IsTrue(rr.GetDepth(typeof (DataException)) > 0);
! Assert.IsTrue(rr.GetDepth(typeof (TransactionSystemException)) > 0);
! }
!
! [Test]
! [ExpectedException(typeof (AopConfigException))]
! public void ConstructorArgMustBeAExceptionClass()
! {
! new RollbackRuleAttribute(typeof (StringBuilder));
! }
!
! [Test]
! [ExpectedException(typeof(ArgumentNullException))]
! public void ConstructorArgMustBeAExceptionClassWithNullThrowableType()
! {
! new RollbackRuleAttribute((Type)null);
! }
!
! [Test]
! [ExpectedException(typeof(ArgumentNullException))]
! public void ConstructorArgExceptionStringNameVersionWithNull()
! {
! new RollbackRuleAttribute((String)null);
! }
!
!
! }
! }
\ No newline at end of file
|