Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 100   Methods: 11
NCLOC: 71 Classes: 3
 
Source File Conditionals Statements Methods TOTAL
Seasar.Tests.Extension.Tx\Impl\TxTest.cs 100.0% 100.0% 72.7% 90.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   using System.Transactions;
21  
22   namespace Seasar.Tests.Extension.Tx.Impl
23   {
24   public interface ITxTest
25   {
26   bool IsInTransaction();
27   string TxId
28   {
29   get;
30   }
31   void throwException();
32   }
33  
34  
35   [global::System.Serializable]
36   public class TxException : Exception
37   {
38   private bool wasInTx;
39  
40   public bool WasInTx
41   {
42 4 get { return wasInTx; }
43 4 set { wasInTx = value; }
44   }
45  
46   private string txId;
47   public string TxId
48   {
49 2 get { return txId; }
50 4 set { txId = value; }
51   }
52  
53 4 public TxException() { }
54 0 public TxException(string message) : base(message) { }
55 0 public TxException(string message, Exception inner) : base(message, inner) { }
56 0 protected TxException(
57   System.Runtime.Serialization.SerializationInfo info,
58   System.Runtime.Serialization.StreamingContext context)
59   : base(info, context) { }
60   }
61  
62   public class TxTest : ITxTest
63   {
64  
65   #region ITxTest メンバ
66  
67 7 public bool IsInTransaction()
68   {
69 7 Transaction tx = Transaction.Current;
70 7 if (tx != null)
71   {
72 6 return tx.TransactionInformation.Status == TransactionStatus.Active;
73   }
74 1 return false;
75   }
76  
77   public string TxId
78   {
79 7 get {
80 7 Transaction tx = Transaction.Current;
81 7 if (tx != null)
82   {
83 6 return tx.TransactionInformation.LocalIdentifier;
84   }
85 1 return null;
86   }
87   }
88  
89 4 public void throwException()
90   {
91 4 TxException ex = new TxException();
92 4 ex.WasInTx = this.IsInTransaction();
93 4 ex.TxId = this.TxId;
94 4 throw ex;
95   }
96  
97   #endregion
98   }
99   }
100