Clover.NET coverage report - Coverage for s2container.net

Coverage timestamp: 2006年5月30日 11:21:29

File Stats: LOC: 108   Methods: 8
NCLOC: 96 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Extension.Tx\Impl\RequiresNewInterceptorTest.cs - 93.8% 100.0% 95.0%
coverage coverage
1   using System;
2   using System.Data;
3   using System.IO;
4   using System.Reflection;
5   using System.Transactions;
6  
7   using log4net;
8   using log4net.Config;
9   using log4net.Util;
10  
11   using NUnit.Framework;
12  
13   using Seasar.Framework.Container.Factory;
14   using Seasar.Framework.Unit;
15  
16   namespace Seasar.Tests.Extension.Tx.Impl
17   {
18   [TestFixture]
19   public class RequiresNewInterceptorTest : S2FrameworkTestCaseBase
20   {
21   private ITxTest txTest;
22  
23   public ITxTest TxTest
24   {
25 4 get { return txTest; }
26 1 set { txTest = value; }
27   }
28  
29 1 public RequiresNewInterceptorTest()
30   {
31 1 FileInfo info = new FileInfo(SystemInfo.AssemblyFileName(
32   Assembly.GetExecutingAssembly()) + ".config");
33 1 XmlConfigurator.Configure(LogManager.GetRepository(), info);
34 1 base.Container = S2ContainerFactory.Create(base.ConvertPath("RequiresNewInterceptorTest.dicon"));
35 1 base.Container.Init();
36 1 this.TxTest = base.GetComponent(typeof(ITxTest)) as ITxTest;
37   }
38  
39 1 [Test]
40   public void StartTx()
41   {
42 1 Assert.AreEqual(true, this.TxTest.IsInTransaction());
43   }
44  
45 1 [Test]
46   public void StartTxInTx()
47   {
48 1 using (TransactionScope scope = new TransactionScope())
49   {
50 1 Transaction tx = Transaction.Current;
51 1 Assert.AreEqual(false, tx.TransactionInformation.LocalIdentifier.Equals(TxTest.TxId));
52   }
53   }
54 1 [Test]
55   public void ThrowException()
56   {
57 1 try
58   {
59 1 this.TxTest.throwException();
60 0 Assert.Fail();
61   }
62   catch (TxException e)
63   {
64 1 Assert.IsTrue(e.WasInTx);
65   }
66   }
67  
68 1 [Test]
69   public void ThrowExceptionInTx()
70   {
71 1 using (TransactionScope scope = new TransactionScope())
72   {
73 1 Transaction tx = Transaction.Current;
74 1 try
75   {
76 1 this.TxTest.throwException();
77 0 Assert.Fail();
78   }
79   catch (TxException e)
80   {
81 1 Assert.IsTrue(e.WasInTx);
82 1 Assert.AreEqual(false, tx.TransactionInformation.LocalIdentifier.Equals(e.TxId));
83   }
84 1 Assert.IsTrue(tx.TransactionInformation.Status == TransactionStatus.Active);
85   }
86   }
87  
88 1 [Test]
89   public void ScopeTest()
90   {
91 1 using (TransactionScope scope = new TransactionScope())
92   {
93 1 Transaction tx = Transaction.Current;
94 1 using (TransactionScope scope2 = new TransactionScope(TransactionScopeOption.Required))
95   {
96 1 Transaction tx2 = Transaction.Current;
97 1 Assert.IsTrue(tx.TransactionInformation.Status == TransactionStatus.Active,"0");
98 1 Assert.IsTrue(tx2.TransactionInformation.Status == TransactionStatus.Active, "1");
99 1 scope2.Complete();
100   }
101  
102 1 Assert.IsTrue(tx.TransactionInformation.Status == TransactionStatus.Active, "2");
103 1 scope.Complete();
104   }
105   }
106   }
107   }
108