Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 122   Methods: 8
NCLOC: 95 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Extension.DataSets.Types\ObjectType.cs 35.7% 44.4% 50.0% 42.9%
coverage 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.Data;
21   using Seasar.Extension.ADO;
22   using Nullables;
23  
24   namespace Seasar.Extension.DataSets.Types
25   {
26   public class ObjectType : IColumnType
27   {
28 6 public ObjectType()
29   {
30   }
31  
32   #region IColumnType メンバ
33  
34 0 public virtual object Convert(object value, string formatPattern)
35   {
36   if (IsNullable(value))
37   {
38   return DBNull.Value;
39   }
40   return value;
41   }
42  
43 26 public bool Equals1(object arg1, object arg2)
44   {
45 26 return DoEquals(arg1, arg2);
46   }
47  
48 0 public virtual string ToDbTypeString()
49   {
50   return "VARCHAR";
51   }
52  
53 0 public virtual DbType GetDbType()
54   {
55   return DbType.Object;
56   }
57  
58 0 public virtual Type GetColumnType()
59   {
60   return typeof(object);
61   }
62  
63   #endregion
64  
65 26 protected virtual bool DoEquals(object arg1, object arg2)
66   {
67 26 try
68   {
69 26 if (IsNullable(arg1))
70   {
71 0 arg1 = DBNull.Value;
72   }
73   else
74   {
75 26 arg1 = Convert(arg1, null);
76   }
77   }
78   catch
79   {
80 0 return false;
81   }
82 26 try
83   {
84 26 if (IsNullable(arg2))
85   {
86 0 arg2 = DBNull.Value;
87   }
88   else
89   {
90 26 arg2 = Convert(arg2, null);
91   }
92   }
93   catch
94   {
95 0 return false;
96   }
97 26 return arg1.Equals(arg2);
98   }
99  
100 454 protected bool IsNullable(object value)
101   {
102 454 if (value == null)
103   {
104 0 return true;
105   }
106 454 if (value == DBNull.Value)
107   {
108 0 return true;
109   }
110 454 if (value is INullableType)
111   {
112 0 INullableType nt = (INullableType) value;
113 0 if (!((INullableType) value).HasValue)
114   {
115   return true;
116   }
117   }
118 454 return false;
119   }
120   }
121   }
122