Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 114   Methods: 6
NCLOC: 82 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Extension.DataSets\Impl\SqlTableWriterTest.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.Data;
20   using MbUnit.Framework;
21   using Seasar.Extension.DataSets.Impl;
22   using Seasar.Extension.Unit;
23   using Seasar.Framework.Util;
24  
25   namespace Seasar.Tests.Extension.DataSets.Impl
26   {
27   [TestFixture]
28   public class SqlTableWriterTest : S2TestCase
29   {
30   private const string PATH = "Ado.dicon";
31  
32 1 public void SetUpCreated()
33   {
34 1 Include(PATH);
35   }
36  
37 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
38   public void Created()
39   {
40 1 DataTable table = new DataTable("emp");
41 1 table.Columns.Add("empno", typeof(int));
42 1 table.Columns.Add("ename", typeof(string));
43 1 table.Columns.Add("dname", typeof(string));
44 1 DataRow row = table.NewRow();
45 1 row["empno"] = 9900;
46 1 row["ename"] = "hoge";
47 1 row["dname"] = "aaa";
48 1 table.Rows.Add(row);
49  
50 1 SqlTableWriter writer = new SqlTableWriter(DataSource);
51  
52  
53 1 writer.Write(table);
54  
55 1 SqlTableReader reader = new SqlTableReader(DataSource);
56 1 reader.SetTable("emp", "empno = 9900");
57 1 DataTable ret = reader.Read();
58 1 DataTableInspector.OutWriteLine(ret);
59 1 Assert.IsNotNull(ret, "1");
60   }
61  
62 1 public void SetUpModified()
63   {
64 1 Include(PATH);
65   }
66  
67 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
68   public void Modified()
69   {
70 1 SqlTableReader reader = new SqlTableReader(DataSource);
71 1 string sql = "SELECT empno, ename, dname FROM emp, dept WHERE empno = 7788 AND emp.deptno = dept.deptno";
72 1 reader.SetSql(sql, "emp");
73 1 DataTable table = reader.Read();
74 1 DataRow row = table.Rows[0];
75 1 row["ename"] = "hoge";
76 1 row["dname"] = "aaa";
77  
78 1 SqlTableWriter writer = new SqlTableWriter(DataSource);
79 1 writer.Write(table);
80  
81 1 SqlTableReader reader2 = new SqlTableReader(DataSource);
82 1 reader2.SetTable("emp", "empno = 7788");
83 1 DataTable table2 = reader2.Read();
84 1 DataTableInspector.OutWriteLine(table2);
85 1 Assert.AreEqual("hoge", table2.Rows[0]["ename"], "1");
86   }
87  
88 1 public void SetUpRemoved()
89   {
90 1 Include(PATH);
91   }
92  
93 1 [Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
94   public void Removed()
95   {
96 1 SqlTableReader reader = new SqlTableReader(DataSource);
97 1 string sql = "SELECT empno, ename, dname FROM emp, dept WHERE empno = 7788 AND emp.deptno = dept.deptno";
98 1 reader.SetSql(sql, "emp");
99 1 DataTable table = reader.Read();
100 1 DataRow row = table.Rows[0];
101 1 row.Delete();
102  
103 1 SqlTableWriter writer = new SqlTableWriter(DataSource);
104 1 writer.Write(table);
105  
106 1 SqlTableReader reader2 = new SqlTableReader(DataSource);
107 1 reader2.SetTable("emp", "empno = 7788");
108 1 DataTable table2 = reader2.Read();
109 1 DataTableInspector.OutWriteLine(table2);
110 1 Assert.AreEqual(0, table2.Rows.Count, "1");
111   }
112   }
113   }
114