Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 87   Methods: 1
NCLOC: 64 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Extension.Unit\BeanListReaderTest.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.Collections;
21   using System.Data;
22   using MbUnit.Framework;
23   using Seasar.Extension.Unit;
24  
25   namespace Seasar.Tests.Extension.Unit
26   {
27   [TestFixture]
28   public class BeanListReaderTest
29   {
30 1 [Test]
31   public void TestRead()
32   {
33 1 BasicTypeBean bean = new BasicTypeBean();
34 1 bean.Id = 1;
35 1 bean.BoolType = true;
36 1 bean.SbyteType = SByte.MaxValue;
37 1 bean.ByteType = Byte.MaxValue;
38 1 bean.Int16Type = Int16.MaxValue;
39 1 bean.Int32Type = Int32.MaxValue;
40 1 bean.Int64Type = Int64.MaxValue;
41 1 bean.DecimalType = Decimal.MaxValue;
42 1 bean.SingleType = Single.MaxValue;
43 1 bean.DoubleType = Double.MaxValue;
44 1 bean.StringType = "abcde";
45 1 bean.DateTimeType = new DateTime(1999, 12, 31);
46  
47 1 IList list = new ArrayList();
48 1 list.Add(bean);
49  
50 1 BeanListReader reader = new BeanListReader(list);
51 1 DataSet ds = reader.Read();
52 1 DataTable table = ds.Tables[0];
53 1 DataRow row = table.Rows[0];
54 1 DataColumnCollection columns = table.Columns;
55  
56 1 Assert.AreEqual(DataRowState.Unchanged, row.RowState);
57 1 Assert.AreEqual(12, columns.Count);
58  
59 1 Assert.AreEqual(1, row["id"]);
60 1 Assert.AreEqual(true, row["booltype"]);
61 1 Assert.AreEqual(SByte.MaxValue, row["sbytetype"]);
62 1 Assert.AreEqual(Byte.MaxValue, row["bytetype"]);
63 1 Assert.AreEqual(Int16.MaxValue, row["int16type"]);
64 1 Assert.AreEqual(Int32.MaxValue, row["int32type"]);
65 1 Assert.AreEqual(Int64.MaxValue, row["int64type"]);
66 1 Assert.AreEqual(Decimal.MaxValue, row["decimaltype"]);
67 1 Assert.AreEqual(Single.MaxValue, row["singletype"]);
68 1 Assert.AreEqual(Double.MaxValue, row["doubletype"]);
69 1 Assert.AreEqual("abcde", row["stringtype"]);
70 1 Assert.AreEqual(new DateTime(1999, 12, 31), row["datetimetype"]);
71  
72 1 Assert.AreEqual(typeof(long), columns["id"].DataType);
73 1 Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
74 1 Assert.AreEqual(typeof(sbyte), columns["sbytetype"].DataType);
75 1 Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
76 1 Assert.AreEqual(typeof(short), columns["int16type"].DataType);
77 1 Assert.AreEqual(typeof(int), columns["int32type"].DataType);
78 1 Assert.AreEqual(typeof(long), columns["int64type"].DataType);
79 1 Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
80 1 Assert.AreEqual(typeof(float), columns["singletype"].DataType);
81 1 Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
82 1 Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
83 1 Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
84   }
85   }
86   }
87