Clover.NET coverage report - Coverage for s2dao.net

Coverage timestamp: 2006年5月30日 11:48:56

File Stats: LOC: 71   Methods: 5
NCLOC: 49 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Dao.Node\IfNode.cs 75.0% 81.3% 80.0% 79.3%
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  
21   namespace Seasar.Dao.Node
22   {
23   public class IfNode : ContainerNode
24   {
25   private string expression;
26   private ElseNode elseNode;
27   private ExpressionUtil expressionUtil;
28  
29 29 public IfNode(string expression)
30   {
31 29 expressionUtil = new ExpressionUtil();
32 29 this.expression = expressionUtil.parseExpression(expression);
33 29 if (this.expression == null)
34 0 throw new ApplicationException("IllegalBoolExpression=[" + this.expression + "]");
35   }
36  
37   public string Expression
38   {
39 1 get { return this.expression; }
40   }
41  
42   public ElseNode ElseNode
43   {
44 0 get { return elseNode; }
45 5 set { elseNode = value; }
46   }
47  
48 31 public override void Accept(ICommandContext ctx)
49   {
50 31 object result = InvokeExpression(this.expression, ctx);
51 31 if (result != null)
52   {
53 31 if(Convert.ToBoolean(result))
54   {
55 16 base.Accept(ctx);
56 16 ctx.IsEnabled = true;
57   }
58 15 else if (elseNode != null)
59   {
60 5 elseNode.Accept(ctx);
61 5 ctx.IsEnabled = true;
62   }
63   }
64   else
65   {
66 0 throw new ApplicationException("IllegalBoolExpression=[" + this.expression + "]");
67   }
68   }
69   }
70   }
71