Clover.NET coverage report - Coverage for s2dao.net

Coverage timestamp: 2006年5月30日 11:48:56

File Stats: LOC: 113   Methods: 8
NCLOC: 86 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Dao.Tests.Interceptors\S2DaoInterceptorTest.cs 100.0% 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 Seasar.Framework.Container;
24   using Seasar.Framework.Container.Factory;
25   using Seasar.Extension.Unit;
26   using MbUnit.Framework;
27   using log4net;
28   using log4net.Config;
29   using log4net.Util;
30  
31   namespace Seasar.Dao.Tests.Interceptors
32   {
33   [TestFixture]
34   public class S2DaoInterceptorTest : S2TestCase
35   {
36   private IEmployeeDao _employeeDao = null;
37   private ILog _log= LogManager.GetLogger(typeof(S2DaoInterceptorTest));
38  
39 1 public S2DaoInterceptorTest()
40   {
41 1 FileInfo info = new FileInfo(SystemInfo.AssemblyShortName(
42   Assembly.GetExecutingAssembly()) + ".dll.config");
43 1 XmlConfigurator.Configure(LogManager.GetRepository(), info);
44   }
45  
46 1 [Test, S2()]
47   public void TestSelectBeanList()
48   {
49 1 IList employees = _employeeDao.GetAllEmployees();
50 15 for (int i = 0; i < employees.Count; ++i) {
51 14 _log.Debug(employees[i].ToString());
52   }
53 1 Assert.AreEqual(true, employees.Count > 0, "1");
54   }
55  
56 1 [Test, S2()]
57   public void TestSelectBean()
58   {
59 1 Employee employee = _employeeDao.GetEmployee(7788);
60 1 _log.Debug(employee.ToString());
61 1 Assert.AreEqual("SCOTT", employee.Ename, "1");
62   }
63  
64 1 [Test, S2()]
65   public void TestSelectObject()
66   {
67 1 int count = _employeeDao.GetCount();
68 1 _log.Debug("count:" + count);
69 1 Assert.AreEqual(true, count > 0, "1");
70   }
71  
72 1 [Test, S2(Tx.Rollback)]
73   public void TestUpdate()
74   {
75 1 Employee employee = _employeeDao.GetEmployee(7788);
76 1 Assert.AreEqual(1, _employeeDao.Update(employee), "1");
77   }
78  
79 1 [Test, S2(Tx.Rollback)]
80   public void TestInsert()
81   {
82 1 Assert.AreEqual(1, _employeeDao.Insert(9999, "hoge"));
83   }
84  
85 1 [Test, S2()]
86   public void TestSelectNullables()
87   {
88 1 Employee emp = new Employee();
89 1 emp.Ename = "SCOTT";
90 1 Assert.AreEqual(7788, _employeeDao.GetEmpnoByEmp(emp).Value);
91 1 Assert.IsTrue(_employeeDao.GetEmpnoByEmp(null).HasValue);
92 1 emp.Ename = "Kazuya";
93 1 Assert.IsFalse(_employeeDao.GetEmpnoByEmp(emp).HasValue);
94   }
95  
96 1 [Test, S2()]
97   public void TestSelectSqlTypes()
98   {
99 1 Hoge hoge = new Hoge();
100 1 Hoge hoge2 = new Hoge();
101 1 hoge2.Val = "SCOTT";
102 1 hoge.Parent = hoge2;
103 1 Assert.AreEqual(7788, _employeeDao.GetEmpnoByHoge(hoge).Value);
104 1 Assert.IsFalse(_employeeDao.GetEmpnoByHoge(null).IsNull);
105 1 hoge2.Val = "Kazuya";
106 1 Assert.IsTrue(_employeeDao.GetEmpnoByHoge(hoge).IsNull);
107 1 hoge2.Val = null;
108 1 Assert.IsTrue(_employeeDao.GetEmpnoByHoge2(hoge).IsNull);
109   }
110  
111   }
112   }
113