Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 122   Methods: 11
NCLOC: 93 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Extension.ADO\Impl\BasicUpdateHandlerTest.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.IO;
21   using System.Reflection;
22   using log4net;
23   using log4net.Config;
24   using log4net.Util;
25   using MbUnit.Framework;
26   using Nullables;
27   using Seasar.Extension.ADO;
28   using Seasar.Extension.ADO.Impl;
29   using Seasar.Extension.Unit;
30  
31   namespace Seasar.Tests.Extension.ADO.Impl
32   {
33   [TestFixture]
34   public class BasicUpdateHandlerTest : S2TestCase
35   {
36   private const string PATH = "Ado.dicon";
37  
38 1 static BasicUpdateHandlerTest()
39   {
40 1 FileInfo info = new FileInfo(SystemInfo.AssemblyFileName(
41   Assembly.GetExecutingAssembly()) + ".config");
42 1 XmlConfigurator.Configure(LogManager.GetRepository(), info);
43   }
44  
45 1 public void SetUpExecute()
46   {
47 1 Include(PATH);
48   }
49  
50 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
51   public void Execute()
52   {
53 1 string sql = "update emp set ename = @ename, comm = @comm where empno = @empno";
54 1 BasicUpdateHandler handler = new BasicUpdateHandler(DataSource, sql);
55 1 object[] args = new object[] { "SCOTT", null, 7788 };
56 1 Type[] argTypes = new Type[] { typeof(string), typeof(NullableInt32), typeof(int) };
57 1 string[] argNames = new string[] { "ename", "comm", "empno" };
58 1 int ret = handler.Execute(args, argTypes, argNames);
59 1 Assert.AreEqual(1, ret, "1");
60   }
61  
62 1 public void SetUpExecuteNullArgs()
63   {
64 1 Include(PATH);
65   }
66  
67 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
68   public void ExecuteNullArgs()
69   {
70 1 string sql = "delete from emp";
71 1 BasicUpdateHandler handler = new BasicUpdateHandler(DataSource, sql);
72 1 int ret = handler.Execute(null);
73 1 Assert.AreEqual(14, ret, "1");
74   }
75  
76 1 public void SetUpExecuteAtmarkWithParam()
77   {
78 1 Include(PATH);
79   }
80  
81 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
82   public void ExecuteAtmarkWithParam()
83   {
84 1 string sql = "update emp set ename = @ename, comm = @comm where empno = @empno";
85 1 BasicUpdateHandler handler = new BasicUpdateHandler(DataSource, sql);
86 1 object[] args = new object[] { "SCOTT", null, 7788 };
87 1 int ret = handler.Execute(args);
88 1 Assert.AreEqual(1, ret, "1");
89   }
90  
91 1 public void SetUpExecuteColonWithParam()
92   {
93 1 Include(PATH);
94   }
95  
96 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
97   public void ExecuteColonWithParam()
98   {
99 1 string sql = "update emp set ename = :ename, comm = :comm where empno = :empno";
100 1 BasicUpdateHandler handler = new BasicUpdateHandler(DataSource, sql);
101 1 object[] args = new object[] { "SCOTT", null, 7788 };
102 1 int ret = handler.Execute(args);
103 1 Assert.AreEqual(1, ret, "1");
104   }
105  
106 1 public void SetUpExecuteQuestionWithParam()
107   {
108 1 Include(PATH);
109   }
110  
111 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
112   public void ExecuteQuestionWithParam()
113   {
114 1 string sql = "update emp set ename = ?, comm = ? where empno = ?";
115 1 BasicUpdateHandler handler = new BasicUpdateHandler(DataSource, sql);
116 1 object[] args = new object[] { "SCOTT", null, 7788 };
117 1 int ret = handler.Execute(args);
118 1 Assert.AreEqual(1, ret, "1");
119   }
120   }
121   }
122