Clover.NET coverage report - Coverage

Coverage timestamp: Friday, May 20, 2005 9:17:00 PM

File Stats: LOC: 102   Methods: 5
NCLOC: 53 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
TypeHandlers\DecimalTypeHandler.cs 75.0 % 81.8 % 80.0 % 80.0 %
coverage coverage
1  
2   #region Apache Notice
3   /*****************************************************************************
4   * $Header: $
5   * $Revision: $
6   * $Date: $
7   *
8   * iBATIS.NET Data Mapper
9   * Copyright (C) 2004 - Gilles Bayon
10   *
11   *
12   * Licensed under the Apache License, Version 2.0 (the "License");
13   * you may not use this file except in compliance with the License.
14   * You may obtain a copy of the License at
15   *
16   * http://www.apache.org/licenses/LICENSE-2.0
17   *
18   * Unless required by applicable law or agreed to in writing, software
19   * distributed under the License is distributed on an "AS IS" BASIS,
20   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21   * See the License for the specific language governing permissions and
22   * limitations under the License.
23   *
24   ********************************************************************************/
25   #endregion
26  
27   #region Using
28  
29   using System;
30   using System.Data;
31   using System.Globalization;
32  
33   using IBatisNet.DataMapper.Configuration.ResultMapping;
34   #endregion
35  
36  
37  
38   namespace IBatisNet.DataMapper.TypeHandlers
39   {
40   /// <summary>
41   /// Description résumée de DecimalTypeHandler.
42   /// </summary>
43   internal class DecimalTypeHandler : BaseTypeHandler
44   {
45  
46  
47   /// <summary>
48   ///
49   /// </summary>
50   /// <param name="mapping"></param>
51   /// <param name="dataReader"></param>
52   /// <returns></returns>
53 30 public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
54   {
55 30 int index = dataReader.GetOrdinal(mapping.ColumnName);
56  
57 30 if (dataReader.IsDBNull(index) == true)
58   {
59 3 return System.DBNull.Value;
60   }
61   else
62   {
63 27 return dataReader.GetDecimal(index);
64   }
65   }
66  
67 1 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
68   {
69 1 if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
70   {
71 0 return System.DBNull.Value;
72   }
73   else
74   {
75 1 return dataReader.GetDecimal(mapping.ColumnIndex);
76   }
77   }
78  
79 4 public override object ValueOf(Type type, string s)
80   {
81 4 CultureInfo culture = new CultureInfo( "en-US" );
82   // nullValue decimal must be in format ######.##
83   // where . is separator for decimal
84 4 return decimal.Parse(s, culture);
85   }
86  
87 0 public override object GetDataBaseValue(object outputValue, Type parameterType )
88   {
89   return Convert.ToDecimal(outputValue);
90   }
91  
92  
93   public override bool IsSimpleType
94   {
95 1 get
96   {
97 1 return true;
98   }
99   }
100   }
101   }
102