Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 129   Methods: 8
NCLOC: 98 Classes: 5
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Framework.Container\Assembler\DefaultDestroyMethodAssemblerTest.cs - 86.8% 37.5% 78.3%
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.Collections;
21   using Seasar.Framework.Beans;
22   using Seasar.Framework.Container;
23   using Seasar.Framework.Container.Assembler;
24   using Seasar.Framework.Container.Impl;
25   using NUnit.Framework;
26  
27   namespace Seasar.Tests.Framework.Container.Assembler
28   {
29   /// <summary>
30   /// DefaultDestroyMethodAssemblerTest の概要の説明です。
31   /// </summary>
32   [TestFixture]
33   public class DefaultDestroyMethodAssemblerTest
34   {
35 1 [Test]
36   public void TestAssemble()
37   {
38 1 IS2Container container = new S2ContainerImpl();
39 1 ComponentDefImpl cd = new ComponentDefImpl(typeof(Hashtable));
40 1 DestroyMethodDefImpl md = new DestroyMethodDefImpl("Add");
41 1 IArgDef argDef = new ArgDefImpl("aaa");
42 1 md.AddArgDef(argDef);
43 1 IArgDef argDef2 = new ArgDefImpl("111");
44 1 md.AddArgDef(argDef2);
45 1 cd.AddDestroyMethodDef(md);
46 1 container.Register(cd);
47 1 IMethodAssembler assembler = new DefaultDestroyMethodAssembler(cd);
48 1 Hashtable table = new Hashtable();
49 1 assembler.Assemble(table);
50 1 Assert.AreEqual("111",table["aaa"]);
51   }
52  
53 1 [Test]
54   public void TestAssembleForExpression()
55   {
56 1 IS2Container container = new S2ContainerImpl();
57 1 ComponentDefImpl cd = new ComponentDefImpl(typeof(Hashtable));
58 1 IDestroyMethodDef md = new DestroyMethodDefImpl();
59 1 md.Expression = "self.Add('aaa','111')";
60 1 cd.AddDestroyMethodDef(md);
61 1 container.Register(cd);
62 1 IMethodAssembler assembler = new DefaultDestroyMethodAssembler(cd);
63 1 Hashtable table = new Hashtable();
64 1 assembler.Assemble(table);
65 1 Assert.AreEqual("111",table["aaa"]);
66   }
67  
68 1 [Test]
69   public void TestAssembleIllegalArgument()
70   {
71 1 IS2Container container = new S2ContainerImpl();
72 1 ComponentDefImpl cd = new ComponentDefImpl(typeof(Hashtable));
73 1 IDestroyMethodDef md = new DestroyMethodDefImpl("Add");
74 1 cd.AddDestroyMethodDef(md);
75 1 container.Register(cd);
76 1 IMethodAssembler assembler = new DefaultDestroyMethodAssembler(cd);
77 1 Hashtable table = new Hashtable();
78 1 try
79   {
80 1 assembler.Assemble(table);
81 0 Assert.Fail("1");
82   }
83   catch(MethodNotFoundRuntimeException ex)
84   {
85 1 Console.WriteLine(ex);
86   }
87   }
88  
89   public interface IFoo
90   {
91   string HogeName{ get; }
92   }
93  
94   public class A : IFoo
95   {
96   private IHoge hoge_;
97  
98 0 public A()
99   {
100   }
101  
102 0 public IHoge Hoge
103   {
104   get { return hoge_; }
105   set{ hoge_ = value; }
106   }
107  
108 0 public string HogeName
109   {
110   get { return hoge_.Name; }
111   }
112   }
113  
114   public interface IHoge
115   {
116   string Name { get; }
117   }
118  
119   public class B : IHoge
120   {
121 0 public string Name
122   {
123   get { return "B"; }
124   }
125   }
126  
127   }
128   }
129