Mercurial > pub > bltoolkit
comparison UnitTests/Fluent/MockDataBase/AssertCommandData.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f990fcb411a9 |
---|---|
1 using Microsoft.VisualStudio.TestTools.UnitTesting; | |
2 | |
3 namespace BLToolkit.Fluent.Test.MockDataBase | |
4 { | |
5 public class AssertCommandData | |
6 { | |
7 private readonly MockCommandData _data; | |
8 | |
9 public AssertCommandData(MockCommandData data) | |
10 { | |
11 _data = data; | |
12 } | |
13 | |
14 public void AreField(string fieldName, int? count = null, string message = null) | |
15 { | |
16 int fCount = _data.Fields.TryGetValue(fieldName, out fCount) ? fCount : 0; | |
17 if ((null == count) && (0 < fCount)) | |
18 { | |
19 return; | |
20 } | |
21 if ((null != count) && (count.Value == fCount)) | |
22 { | |
23 return; | |
24 } | |
25 Assert.Fail(message ?? string.Format("Fail field '{0}'", fieldName)); | |
26 } | |
27 | |
28 public void AreField(string fieldName, string message = null) | |
29 { | |
30 AreField(fieldName, null, message); | |
31 } | |
32 | |
33 public void AreNotField(string fieldName, string message = null) | |
34 { | |
35 AreField(fieldName, 0, message); | |
36 } | |
37 | |
38 public void AreTable(string tableName, string message = null) | |
39 { | |
40 if (!_data.Tables.Contains(tableName)) | |
41 { | |
42 Assert.Fail(message ?? string.Format("Fail table '{0}'", tableName)); | |
43 } | |
44 } | |
45 } | |
46 } |