Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 115   Methods: 7
NCLOC: 84 Classes: 2
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Extension.Tx\RequiredInterceptorTest.cs - 65.0% 71.4% 66.7%
coverage coverage
1   #region Copyright
2   /*
3   * Copyright 2005 the Seasar Foundation and the Others.
4   *
5   * Licensed under the Apache License, Version 2.0 (the "License");
6   * you may not use this file except in compliance with the License.
7   * You may obtain a copy of the License at
8   *
9   * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14   * either express or implied. See the License for the specific language
15   * governing permissions and limitations under the License.
16   */
17   #endregion
18  
19   using System;
20   using System.IO;
21   using System.EnterpriseServices;
22   using System.Reflection;
23  
24   using Seasar.Framework.Container;
25   using Seasar.Framework.Container.Factory;
26  
27   using log4net;
28   using log4net.Config;
29   using log4net.Util;
30  
31   using NUnit.Framework;
32  
33   namespace Seasar.Tests.Extension.Tx
34   {
35   /// <summary>
36   /// RequiredInterceptorTest の概要の説明です。
37   /// </summary>
38   [TestFixture]
39   public class DTCRequiredInterceptorTest
40   {
41   private const string path = "Seasar/Tests/Extension/Tx/DTCRequiredInterceptorTest.dicon";
42 1 static DTCRequiredInterceptorTest()
43   {
44 1 FileInfo info = new FileInfo(SystemInfo.AssemblyFileName(
45   Assembly.GetExecutingAssembly()) + ".config");
46 1 XmlConfigurator.Configure(LogManager.GetRepository(), info);
47   }
48  
49   private IS2Container container = null;
50   private TxTest tester = null;
51 2 [SetUp]
52   public void SetUp()
53   {
54 2 container = S2ContainerFactory.Create(path);
55 2 container.Init();
56 2 tester = container.GetComponent(typeof(TxTest)) as TxTest;
57   }
58  
59 1 [Test]
60   public void TestProceed()
61   {
62 1 Assert.IsTrue(tester.IsInTransaction());
63 1 Assert.IsFalse(ContextUtil.IsInTransaction);
64   }
65  
66 1 [Test]
67   public void TestProceedException()
68   {
69 1 try
70   {
71 1 tester.throwException();
72 0 Assert.Fail();
73   }
74   catch(Exception e)
75   {
76 1 Assert.IsTrue(e is NotSupportedException);
77 1 Assert.IsFalse(ContextUtil.IsInTransaction);
78   }
79  
80   }
81   }
82  
83   [TestFixture]
84   [Transaction(TransactionOption.RequiresNew)]
85   public class DTCRequiredInterceptorTestES : ServicedComponent
86   {
87   private const string path = "Seasar/Tests/Extension/Tx/DTCRequiredInterceptorTest.dicon";
88 1 static DTCRequiredInterceptorTestES()
89   {
90 1 FileInfo info = new FileInfo(SystemInfo.AssemblyFileName(
91   Assembly.GetExecutingAssembly()) + ".config");
92 1 XmlConfigurator.Configure(LogManager.GetRepository(), info);
93   }
94  
95   private IS2Container container = null;
96   private TxTest tester = null;
97 0 [SetUp]
98   public void SetUp()
99   {
100   container = S2ContainerFactory.Create(path);
101   container.Init();
102   tester = container.GetComponent(typeof(TxTest)) as TxTest;
103   }
104  
105 0 [Test]
106   [AutoComplete]
107   public void TestProceed()
108   {
109   Guid guid = ContextUtil.TransactionId;
110   Assert.IsTrue(tester.IsInTransaction());
111   Assert.AreEqual(guid, tester.GetTransactionId());
112   }
113   }
114   }
115