Mercurial > pub > bltoolkit
comparison UnitTests/CS/DataAccess/ScalarListTest.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 System; | |
2 using System.Collections; | |
3 using System.Collections.Generic; | |
4 | |
5 using NUnit.Framework; | |
6 | |
7 using BLToolkit.Data; | |
8 using BLToolkit.DataAccess; | |
9 | |
10 namespace DataAccess | |
11 { | |
12 [TestFixture] | |
13 public class ScalarListTest | |
14 { | |
15 public abstract class TestAccessor : DataAccessor | |
16 { | |
17 [SprocName("Person_SelectAll")] | |
18 [ObjectType(typeof(int))] | |
19 public abstract ArrayList SelectIDs (DbManager db); | |
20 | |
21 [SprocName("Person_SelectAll")] | |
22 [ObjectType(typeof(string)), ScalarFieldName(1)] | |
23 public abstract ArrayList SelectFirstNames(DbManager db); | |
24 | |
25 [SprocName("Person_SelectAll")] | |
26 [ObjectType(typeof(string)), ScalarFieldName("LastName")] | |
27 public abstract ArrayList SelectLastNames (DbManager db); | |
28 | |
29 [SprocName("Person_SelectAll")] | |
30 public abstract List<int> GenericsSelectIDs (DbManager db); | |
31 | |
32 [SprocName("Person_SelectAll")] | |
33 [ScalarFieldName(1)] | |
34 public abstract List<string> GenericsSelectFirstNames (DbManager db); | |
35 | |
36 [SprocName("Person_SelectAll")] | |
37 [ScalarFieldName("LastName")] | |
38 public abstract List<string> GenericsSelectLastNames (DbManager db); | |
39 | |
40 [SprocName("Person_SelectAll"), ObjectType(typeof(int))] | |
41 public abstract List<IConvertible> GenericsSelectIDsAsIConvertible(DbManager db); | |
42 | |
43 [SprocName("Person_SelectAll")] | |
44 public abstract void GenericsSelectIDsReturnVoid (DbManager db, [Destination] List<int> list); | |
45 | |
46 public static TestAccessor CreateInstance() | |
47 { | |
48 return (TestAccessor)CreateInstance(typeof(TestAccessor)); | |
49 } | |
50 } | |
51 | |
52 [Test] | |
53 public void SelectIDsTest() | |
54 { | |
55 using (DbManager db = new DbManager()) | |
56 { | |
57 TestAccessor ta = TestAccessor.CreateInstance(); | |
58 ArrayList list = ta.SelectIDs(db); | |
59 | |
60 Assert.IsNotNull (list); | |
61 Assert.IsNotEmpty(list); | |
62 Assert.IsTrue(list[0] is int); | |
63 } | |
64 } | |
65 | |
66 [Test] | |
67 public void SelectFirstNamesTest() | |
68 { | |
69 using (DbManager db = new DbManager()) | |
70 { | |
71 TestAccessor ta = TestAccessor.CreateInstance(); | |
72 ArrayList list = ta.SelectFirstNames(db); | |
73 | |
74 Assert.IsNotNull (list); | |
75 Assert.IsNotEmpty(list); | |
76 Assert.IsTrue(list[0] is string); | |
77 } | |
78 } | |
79 | |
80 [Test] | |
81 public void SelectLastNamesTest() | |
82 { | |
83 using (DbManager db = new DbManager()) | |
84 { | |
85 TestAccessor ta = TestAccessor.CreateInstance(); | |
86 ArrayList list = ta.SelectLastNames(db); | |
87 | |
88 Assert.IsNotNull (list); | |
89 Assert.IsNotEmpty(list); | |
90 Assert.IsTrue(list[0] is string); | |
91 } | |
92 } | |
93 | |
94 [Test] | |
95 public void GenericsSelectIDsTest() | |
96 { | |
97 using (DbManager db = new DbManager()) | |
98 { | |
99 TestAccessor ta = TestAccessor.CreateInstance(); | |
100 List<int> list = ta.GenericsSelectIDs(db); | |
101 | |
102 Assert.IsNotNull (list); | |
103 Assert.IsNotEmpty(list); | |
104 } | |
105 } | |
106 | |
107 [Test] | |
108 public void GenericsSelectIDsAsIConvertibleTest() | |
109 { | |
110 using (DbManager db = new DbManager()) | |
111 { | |
112 TestAccessor ta = TestAccessor.CreateInstance(); | |
113 List<IConvertible> list = ta.GenericsSelectIDsAsIConvertible(db); | |
114 | |
115 Assert.IsNotNull (list); | |
116 Assert.IsNotEmpty(list); | |
117 } | |
118 } | |
119 | |
120 [Test] | |
121 public void GenericsSelectIDsReturnVoidTest() | |
122 { | |
123 using (DbManager db = new DbManager()) | |
124 { | |
125 TestAccessor ta = TestAccessor.CreateInstance(); | |
126 List<int> list = new List<int>(); | |
127 ta.GenericsSelectIDsReturnVoid(db, list); | |
128 | |
129 Assert.IsNotNull (list); | |
130 Assert.IsNotEmpty(list); | |
131 } | |
132 } | |
133 | |
134 [Test] | |
135 public void GenericsSelectFirstNamesTest() | |
136 { | |
137 using (DbManager db = new DbManager()) | |
138 { | |
139 TestAccessor ta = TestAccessor.CreateInstance(); | |
140 List<string> list = ta.GenericsSelectFirstNames(db); | |
141 | |
142 Assert.IsNotNull (list); | |
143 Assert.IsNotEmpty(list); | |
144 } | |
145 } | |
146 | |
147 [Test] | |
148 public void GenericsSelectLastNamesTest() | |
149 { | |
150 using (DbManager db = new DbManager()) | |
151 { | |
152 TestAccessor ta = TestAccessor.CreateInstance(); | |
153 List<string> list = ta.GenericsSelectLastNames(db); | |
154 | |
155 Assert.IsNotNull (list); | |
156 Assert.IsNotEmpty(list); | |
157 } | |
158 } | |
159 } | |
160 } |