Clover.NET coverage report - Coverage

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

File Stats: LOC: 148   Methods: 10
NCLOC: 76 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Scope\ErrorContext.cs 0.0 % 27.6 % 50.0 % 27.7 %
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.Text;
30  
31   #endregion
32  
33   namespace IBatisNet.DataMapper.Scope
34   {
35   /// <summary>
36   /// An error context to help us create meaningful error messages.
37   /// </summary>
38   public class ErrorContext
39   {
40  
41   #region Fields
42  
43   private string _resource = string.Empty;
44   private string _activity = string.Empty;
45   private string _objectId = string.Empty;
46   private string _moreInfo = string.Empty;
47   #endregion
48  
49   #region Properties
50  
51   /// <summary>
52   /// The resource causing the problem
53   /// </summary>
54   public string Resource
55   {
56 0 get { return _resource; }
57 4930 set { _resource = value; }
58   }
59  
60   /// <summary>
61   /// The activity that was happening when the error happened
62   /// </summary>
63   public string Activity
64   {
65 0 get { return _activity; }
66 34850 set { _activity = value; }
67   }
68  
69   /// <summary>
70   /// The object ID where the problem happened
71   /// </summary>
72   public string ObjectId
73   {
74 0 get { return _objectId; }
75 40460 set { _objectId = value; }
76   }
77  
78   /// <summary>
79   /// More information about the error
80   /// </summary>
81   public string MoreInfo
82   {
83 0 get { return _moreInfo; }
84 239554 set { _moreInfo = value; }
85   }
86  
87   #endregion
88  
89   #region Methods
90  
91   /// <summary>
92   /// Clear the error context
93   /// </summary>
94 3230 public void Reset()
95   {
96 3230 _resource = string.Empty;
97 3230 _activity = string.Empty;
98 3230 _objectId = string.Empty;
99 3230 _moreInfo = string.Empty;
100   }
101  
102   /// <summary>
103   ///
104   /// </summary>
105   /// <returns></returns>
106 0 public override string ToString()
107   {
108   StringBuilder message = new StringBuilder();
109  
110   // activity
111   if (_activity != null && _activity.Length > 0)
112   {
113   message.Append("\n- The error occurred while ");
114   message.Append(_activity);
115   message.Append(".");
116   }
117  
118   // more info
119   if (_moreInfo != null && _moreInfo.Length > 0)
120   {
121   message.Append("\n- ");
122   message.Append(_moreInfo);
123   }
124  
125   // resource
126   if (_resource != null && _resource.Length > 0)
127   {
128   message.Append("\n- The error occurred in ");
129   message.Append(_resource);
130   message.Append(".");
131   }
132  
133   // object
134   if (_objectId != null && _objectId.Length > 0)
135   {
136   message.Append(" \n- Check the ");
137   message.Append(_objectId);
138   message.Append(".");
139   }
140  
141   return message.ToString();
142   }
143  
144   #endregion
145  
146   }
147   }
148