Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 207   Methods: 22
NCLOC: 159 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Framework.Unit\S2TestCaseBaseTest.cs - 100.0% 100.0% 100.0%
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.Collections;
21   using System.IO;
22   using System.Reflection;
23   using System.Runtime.Remoting;
24   using log4net;
25   using log4net.Config;
26   using log4net.Util;
27   using MbUnit.Framework;
28   using Seasar.Extension.Unit;
29   using Seasar.Framework.Aop;
30   using Seasar.Framework.Aop.Impl;
31   using Seasar.Framework.Aop.Proxy;
32   using Seasar.Framework.Container;
33   using Seasar.Framework.Log;
34  
35  
36   namespace Seasar.Tests.Framework.Unit
37   {
38   /// <summary>
39   /// FrameworkTestCaseTest の概要の説明です。
40   /// </summary>
41   [TestFixture]
42   public class S2TestCaseBaseTest : S2TestCase
43   {
44   private static Logger logger = Logger.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45   private const String PATH = "S2FrameworkTestCaseTest_ado.dicon";
46   private bool testAaaSetUpInvoked = false;
47   private string _ccc = null;
48   private Hashtable bbb_ = null;
49   private DateTime ddd_ = new DateTime();
50   private IList list1_ = null;
51   private Hoge hoge_ = null;
52  
53 1 static S2TestCaseBaseTest()
54   {
55 1 FileInfo info = new FileInfo(SystemInfo.AssemblyFileName(
56   Assembly.GetExecutingAssembly()) + ".config");
57 1 XmlConfigurator.Configure(LogManager.GetRepository(), info);
58   }
59  
60 1 [Test, S2]
61   public void TestContainer()
62   {
63 1 Assert.IsNotNull(this.Container, "コンテナが取得できるはず");
64   }
65  
66 11 [SetUp]
67   public void SetUp()
68   {
69 11 logger.Debug("SetUp");
70   }
71 1 [Test]
72   public void TestStandard()
73   {
74 1 logger.Debug("TestStandard");
75   }
76  
77 11 [TearDown]
78   public void TearDown()
79   {
80 11 logger.Debug("TearDown");
81   }
82  
83 1 public void SetUpAaa()
84   {
85 1 logger.Debug("SetUpAaa");
86 1 testAaaSetUpInvoked = true;
87   }
88 1 [Test, S2]
89   public void TestAaa()
90   {
91 1 Assert.IsTrue(testAaaSetUpInvoked, "1");
92   }
93  
94 1 public void TearDownAaa()
95   {
96 1 logger.Debug("tearDownAaa");
97   }
98  
99 1 public void SetUpBbbTx()
100   {
101 1 logger.Debug("setUpBbbTx");
102 1 Include(PATH);
103   }
104  
105 1 [Test, S2]
106   public void TestBbbTx()
107   {
108 1 logger.Debug("testBbbTx");
109   }
110  
111 1 public void SetUpBindField()
112   {
113 1 Include(PATH);
114 1 Register(typeof(Hashtable));
115 1 Hashtable s = this.Container.GetComponent(typeof(Hashtable)) as Hashtable;
116 1 s.Add("1", "hoge");
117   }
118  
119 1 [Test, S2]
120   public void TestBindField()
121   {
122 1 Assert.IsNotNull(bbb_, "2");
123 1 Assert.IsTrue(bbb_.Count == 1, "3");
124   }
125  
126 1 public void SetUpBindField2()
127   {
128 1 Include("Seasar/Tests/Framework/Unit/bbb.dicon");
129   }
130  
131 1 [Test, S2]
132   public void TestBindField2()
133   {
134 1 Assert.IsNotNull(bbb_, "1");
135 1 Assert.AreEqual(new DateTime(2006, 4, 1), ddd_, "2");
136 1 Assert.AreEqual("hoge", _ccc, "3");
137   }
138  
139 1 public void SetUpBindField3()
140   {
141 1 Include("ccc.dicon");
142   }
143  
144 1 [Test, S2]
145   public void TestBindField3()
146   {
147 1 Assert.IsNotNull(list1_, "1");
148   }
149  
150 1 [Test, S2]
151   [ExpectedException(typeof(TooManyRegistrationRuntimeException))]
152   public void TestInclude()
153   {
154 1 Include("aaa.dicon");
155 1 GetComponent(typeof(DateTime));
156   }
157  
158 1 public void SetUpIsAssignableFrom()
159   {
160 1 Include("bbb.dicon");
161   }
162  
163 1 [Test, S2]
164   public void TestIsAssignableFrom()
165   {
166 1 Assert.AreEqual(_ccc, "hoge","1");
167   }
168  
169 1 public void SetUpPointcut()
170   {
171 1 Include("ddd.dicon");
172   }
173  
174 1 [Test, S2]
175   public void TestPointcut()
176   {
177 1 AopProxy aopProxy = RemotingServices.GetRealProxy(hoge_) as AopProxy;
178  
179 1 FieldInfo fieldInfo = aopProxy.GetType()
180   .GetField("aspects_", BindingFlags.NonPublic | BindingFlags.Instance);
181  
182 1 IAspect[] aspects = fieldInfo.GetValue(aopProxy) as IAspect[];
183  
184 1 PointcutImpl pointcut = aspects[0].Pointcut as PointcutImpl;
185  
186 1 Assert.AreEqual(pointcut.IsApplied("GetAaa"), false, "1");
187 1 Assert.AreEqual(pointcut.IsApplied("GetGreeting"), false, "2");
188 1 Assert.AreEqual(pointcut.IsApplied("Greeting"), true, "3");
189 1 Assert.AreEqual(pointcut.IsApplied("Greeting2"), true, "4");
190 1 Assert.AreEqual(pointcut.IsApplied("GetGreetingEx"), false, "5");
191  
192 1 hoge_.GetAaa();
193 1 hoge_.GetGreeting();
194 1 hoge_.Greeting();
195 1 hoge_.Greeting2();
196 1 hoge_.GetGreetingEx();
197   }
198  
199 1 [Test, S2]
200   public void TestEmptyComponent()
201   {
202 1 Include("empty.dicon");
203   }
204   }
205  
206   }
207