annotate UnitTests/CS/Data/ExecuteListT.cs @ 2:79a04c6442bf

file name case fix
author cin
date Fri, 22 Aug 2014 13:41:57 +0400
parents f990fcb411a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
1 using System.Collections.Generic;
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
2 using BLToolkit.Reflection;
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
3 using NUnit.Framework;
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
4
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
5 using BLToolkit.Data;
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
6
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
7 namespace Data
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
8 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
9 [TestFixture]
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
10 public class ExecuteListT
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
11 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
12 public class SimpleObject
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
13 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
14 public SimpleObject()
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
15 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
16 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
17
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
18 public SimpleObject(InitContext context)
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
19 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
20 if (context.Parameters != null)
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
21 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
22 Assert.AreEqual(2, context.Parameters.Length);
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
23 Assert.AreEqual("123", context.Parameters[0]);
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
24 Assert.AreEqual("456", context.Parameters[1]);
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
25 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
26 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
27
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
28 private int _key; public int Key { get { return _key; } set { _key = value; } }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
29 private string _value; public string Value { get { return _value; } set { _value = value; } }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
30 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
31
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
32 [Test]
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
33 public void Test()
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
34 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
35 using (DbManager db = new DbManager())
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
36 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
37 List<SimpleObject> list = new List<SimpleObject>();
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
38
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
39 db
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
40 #if MSSQL || SQLCE
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
41 .SetCommand(@"
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
42 SELECT 0 as [Key], 'value0' as Value UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
43 SELECT 1 as [Key], 'value1' as Value UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
44 SELECT 2 as [Key], 'value2' as Value")
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
45
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
46 #else // ORACLE || FIREBIRD || ACCESS
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
47
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
48 .SetCommand(@"
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
49 SELECT 0 as ""Key"", 'value0' as ""Value"" FROM Dual UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
50 SELECT 1 as ""Key"", 'value1' as ""Value"" FROM Dual UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
51 SELECT 2 as ""Key"", 'value2' as ""Value"" FROM Dual")
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
52 #endif
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
53 .ExecuteList<SimpleObject>(list);
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
54
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
55 Assert.IsTrue(list.Count > 0);
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
56 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
57 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
58
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
59 [Test]
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
60 public void ParamsTest()
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
61 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
62 using (DbManager db = new DbManager())
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
63 {
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
64 List<SimpleObject> list = db
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
65 #if MSSQL || SQLCE
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
66 .SetCommand(@"
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
67 SELECT 0 as [Key], 'value0' as Value UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
68 SELECT 1 as [Key], 'value1' as Value UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
69 SELECT 2 as [Key], 'value2' as Value")
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
70
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
71 #else // ORACLE || FIREBIRD || ACCESS
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
72
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
73 .SetCommand(@"
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
74 SELECT 0 as ""Key"", 'value0' as ""Value"" FROM Dual UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
75 SELECT 1 as ""Key"", 'value1' as ""Value"" FROM Dual UNION
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
76 SELECT 2 as ""Key"", 'value2' as ""Value"" FROM Dual")
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
77 #endif
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
78 .ExecuteList<SimpleObject>("123", "456");
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
79
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
80 Assert.IsNotEmpty(list);
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
81 Assert.IsInstanceOf(typeof(SimpleObject), list[0]);
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
82 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
83 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
84 }
f990fcb411a9 Копия текущей версии из github
cin
parents:
diff changeset
85 }