Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 136   Methods: 8
NCLOC: 106 Classes: 6
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Framework.Container\Deployer\SessionComponentDeployerWebPage.aspx.cs - 0.0% 0.0% 0.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.Web;
21   using NUnit.Framework;
22   using Seasar.Framework.Aop;
23   using Seasar.Framework.Container;
24   using Seasar.Framework.Container.Deployer;
25   using Seasar.Framework.Container.Impl;
26  
27   namespace Seasar.Tests.Framework.Container.Deployer
28   {
29   public class SessionComponentDeployerWebPage : System.Web.UI.Page
30   {
31   protected System.Web.UI.WebControls.Label ResultLabel;
32  
33 0 public SessionComponentDeployerWebPage()
34   {
35   }
36  
37 0 private void InitializeComponent()
38   {
39   this.Load += new System.EventHandler(this.Page_Load);
40   }
41  
42 0 private void Page_Load(object sender, System.EventArgs e)
43   {
44   IS2Container container = new S2ContainerImpl();
45   container.HttpContext = HttpContext.Current;
46   IComponentDef cd = new ComponentDefImpl(typeof(Foo), "foo");
47   container.Register(cd);
48   IComponentDeployer deployer = new SessionComponentDeployer(cd);
49   Foo foo = (Foo) deployer.Deploy(typeof(Foo));
50   Assert.AreSame(foo, this.Session["foo"]);
51   Assert.AreSame(foo, deployer.Deploy(typeof(Foo)));
52  
53   ComponentDefImpl cd1 = new ComponentDefImpl(typeof(CulcImpl1), "culcTest1");
54   IAspectDef ad1 = new AspectDefImpl();
55   ad1.Expression = "plusOne";
56   ad1.Container = container;
57   cd1.AddAspeceDef(ad1);
58   ComponentDefImpl plusOneCd = new ComponentDefImpl(typeof(PlusOneInterceptor), "plusOne");
59   container.Register(plusOneCd);
60   container.Register(cd1);
61   IComponentDeployer deployer1 = new SessionComponentDeployer(cd1);
62   ICulc culc1 = (ICulc) deployer1.Deploy(typeof(ICulc));
63   Assert.AreEqual(1, culc1.Count());
64  
65   ComponentDefImpl cd2 = new ComponentDefImpl(typeof(CulcImpl2), "culcTest2");
66   IAspectDef ad2 = new AspectDefImpl();
67   ad2.Expression = "plusOne";
68   ad2.Container = container;
69   cd2.AddAspeceDef(ad2);
70   container.Register(cd2);
71   IComponentDeployer deployer2 = new SessionComponentDeployer(cd2);
72   CulcImpl2 culc2 = (CulcImpl2) deployer2.Deploy(typeof(CulcImpl2));
73   PlusOneInterceptor.Count = 0;
74   Assert.AreEqual(1, culc2.Count());
75  
76   ComponentDefImpl cd3 = new ComponentDefImpl(typeof(CulcImpl2), "culcTest3");
77   IAspectDef ad3 = new AspectDefImpl();
78   ad3.Expression = "plusOne";
79   ad3.Container = container;
80   IAspectDef ad4 = new AspectDefImpl();
81   ad4.Expression = "plusOne";
82   ad4.Container = container;
83   cd3.AddAspeceDef(ad3);
84   cd3.AddAspeceDef(ad4);
85   container.Register(cd3);
86   IComponentDeployer deployer3 = new SessionComponentDeployer(cd3);
87   CulcImpl2 culc3 = (CulcImpl2) deployer3.Deploy(typeof(CulcImpl2));
88   PlusOneInterceptor.Count = 0;
89   Assert.AreEqual(2, culc3.Count());
90   }
91  
92   public class Foo
93   {
94   private string message_;
95  
96 0 public string Message
97   {
98   set { message_ = value; }
99   get { return message_; }
100   }
101   }
102  
103   public class PlusOneInterceptor : IMethodInterceptor
104   {
105   public static int Count = 0;
106 0 public object Invoke(IMethodInvocation invocation)
107   {
108   ++Count;
109   invocation.Proceed();
110   return Count;
111   }
112   }
113  
114   public interface ICulc
115   {
116   int Count();
117   }
118  
119   public class CulcImpl1 : ICulc
120   {
121 0 public int Count()
122   {
123   return 0;
124   }
125   }
126  
127   public class CulcImpl2 : MarshalByRefObject, ICulc
128   {
129 0 public int Count()
130   {
131   return 0;
132   }
133   }
134   }
135   }
136