1
|
|
#region Copyright
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
#endregion
|
18
|
|
|
19
|
|
using System;
|
20
|
|
using System.Data;
|
21
|
|
using System.Data.SqlTypes;
|
22
|
|
using MbUnit.Framework;
|
23
|
|
using Seasar.Extension.Unit;
|
24
|
|
|
25
|
|
namespace Seasar.Tests.Extension.Unit
|
26
|
|
{
|
27
|
|
[TestFixture]
|
28
|
|
public class BeanReaderTest
|
29
|
|
{
|
30
|
1
|
[Test]
|
31
|
|
public void TestReadPrimitiveType()
|
32
|
|
{
|
33
|
1
|
BasicTypeBean bean = new BasicTypeBean();
|
34
|
1
|
bean.Id = 1;
|
35
|
1
|
bean.BoolType = true;
|
36
|
1
|
bean.SbyteType = SByte.MaxValue;
|
37
|
1
|
bean.ByteType = Byte.MaxValue;
|
38
|
1
|
bean.Int16Type = Int16.MaxValue;
|
39
|
1
|
bean.Int32Type = Int32.MaxValue;
|
40
|
1
|
bean.Int64Type = Int64.MaxValue;
|
41
|
1
|
bean.DecimalType = Decimal.MaxValue;
|
42
|
1
|
bean.SingleType = Single.MaxValue;
|
43
|
1
|
bean.DoubleType = Double.MaxValue;
|
44
|
1
|
bean.StringType = "abcde";
|
45
|
1
|
bean.DateTimeType = new DateTime(1999, 12, 31);
|
46
|
|
|
47
|
1
|
BeanReader reader = new BeanReader(bean);
|
48
|
1
|
DataSet ds = reader.Read();
|
49
|
1
|
DataTable table = ds.Tables[0];
|
50
|
1
|
DataRow row = table.Rows[0];
|
51
|
1
|
DataColumnCollection columns = table.Columns;
|
52
|
|
|
53
|
1
|
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
|
54
|
1
|
Assert.AreEqual(12, columns.Count);
|
55
|
|
|
56
|
1
|
Assert.AreEqual(1, row["id"]);
|
57
|
1
|
Assert.AreEqual(true, row["booltype"]);
|
58
|
1
|
Assert.AreEqual(SByte.MaxValue, row["sbytetype"]);
|
59
|
1
|
Assert.AreEqual(Byte.MaxValue, row["bytetype"]);
|
60
|
1
|
Assert.AreEqual(Int16.MaxValue, row["int16type"]);
|
61
|
1
|
Assert.AreEqual(Int32.MaxValue, row["int32type"]);
|
62
|
1
|
Assert.AreEqual(Int64.MaxValue, row["int64type"]);
|
63
|
1
|
Assert.AreEqual(Decimal.MaxValue, row["decimaltype"]);
|
64
|
1
|
Assert.AreEqual(Single.MaxValue, row["singletype"]);
|
65
|
1
|
Assert.AreEqual(Double.MaxValue, row["doubletype"]);
|
66
|
1
|
Assert.AreEqual("abcde", row["stringtype"]);
|
67
|
1
|
Assert.AreEqual(new DateTime(1999, 12, 31), row["datetimetype"]);
|
68
|
|
|
69
|
1
|
Assert.AreEqual(typeof(long), columns["id"].DataType);
|
70
|
1
|
Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
|
71
|
1
|
Assert.AreEqual(typeof(sbyte), columns["sbytetype"].DataType);
|
72
|
1
|
Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
|
73
|
1
|
Assert.AreEqual(typeof(short), columns["int16type"].DataType);
|
74
|
1
|
Assert.AreEqual(typeof(int), columns["int32type"].DataType);
|
75
|
1
|
Assert.AreEqual(typeof(long), columns["int64type"].DataType);
|
76
|
1
|
Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
|
77
|
1
|
Assert.AreEqual(typeof(float), columns["singletype"].DataType);
|
78
|
1
|
Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
|
79
|
1
|
Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
|
80
|
1
|
Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
|
81
|
|
}
|
82
|
|
|
83
|
1
|
[Test]
|
84
|
|
public void TestReadNHibernateNullableType()
|
85
|
|
{
|
86
|
1
|
NHibernateNullableBasicTypeBean bean = new NHibernateNullableBasicTypeBean();
|
87
|
1
|
bean.Id = 1;
|
88
|
1
|
bean.BoolType = true;
|
89
|
1
|
bean.SbyteType = SByte.MaxValue;
|
90
|
1
|
bean.ByteType = Byte.MaxValue;
|
91
|
1
|
bean.Int16Type = Int16.MaxValue;
|
92
|
1
|
bean.Int32Type = Int32.MaxValue;
|
93
|
1
|
bean.Int64Type = Int64.MaxValue;
|
94
|
1
|
bean.DecimalType = Decimal.MaxValue;
|
95
|
1
|
bean.SingleType = Single.MaxValue;
|
96
|
1
|
bean.DoubleType = Double.MaxValue;
|
97
|
1
|
bean.StringType = "abcde";
|
98
|
1
|
bean.DateTimeType = new DateTime(1999, 12, 31);
|
99
|
|
|
100
|
1
|
BeanReader reader = new BeanReader(bean);
|
101
|
1
|
DataSet ds = reader.Read();
|
102
|
1
|
DataTable table = ds.Tables[0];
|
103
|
1
|
DataRow row = table.Rows[0];
|
104
|
1
|
DataColumnCollection columns = table.Columns;
|
105
|
|
|
106
|
1
|
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
|
107
|
1
|
Assert.AreEqual(12, columns.Count);
|
108
|
|
|
109
|
1
|
Assert.AreEqual(1, row["id"]);
|
110
|
1
|
Assert.AreEqual(true, row["booltype"]);
|
111
|
1
|
Assert.AreEqual(SByte.MaxValue, row["sbytetype"]);
|
112
|
1
|
Assert.AreEqual(Byte.MaxValue, row["bytetype"]);
|
113
|
1
|
Assert.AreEqual(Int16.MaxValue, row["int16type"]);
|
114
|
1
|
Assert.AreEqual(Int32.MaxValue, row["int32type"]);
|
115
|
1
|
Assert.AreEqual(Int64.MaxValue, row["int64type"]);
|
116
|
1
|
Assert.AreEqual(Decimal.MaxValue, row["decimaltype"]);
|
117
|
1
|
Assert.AreEqual(Single.MaxValue, row["singletype"]);
|
118
|
1
|
Assert.AreEqual(Double.MaxValue, row["doubletype"]);
|
119
|
1
|
Assert.AreEqual("abcde", row["stringtype"]);
|
120
|
1
|
Assert.AreEqual(new DateTime(1999, 12, 31), row["datetimetype"]);
|
121
|
|
|
122
|
1
|
Assert.AreEqual(typeof(long), columns["id"].DataType);
|
123
|
1
|
Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
|
124
|
1
|
Assert.AreEqual(typeof(sbyte), columns["sbytetype"].DataType);
|
125
|
1
|
Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
|
126
|
1
|
Assert.AreEqual(typeof(short), columns["int16type"].DataType);
|
127
|
1
|
Assert.AreEqual(typeof(int), columns["int32type"].DataType);
|
128
|
1
|
Assert.AreEqual(typeof(long), columns["int64type"].DataType);
|
129
|
1
|
Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
|
130
|
1
|
Assert.AreEqual(typeof(float), columns["singletype"].DataType);
|
131
|
1
|
Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
|
132
|
1
|
Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
|
133
|
1
|
Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
|
134
|
|
}
|
135
|
|
|
136
|
1
|
[Test]
|
137
|
|
public void TestReadNHibernateNullableTypeNullValue()
|
138
|
|
{
|
139
|
1
|
NHibernateNullableBasicTypeBean bean = new NHibernateNullableBasicTypeBean();
|
140
|
1
|
bean.Id = null;
|
141
|
1
|
bean.BoolType = null;
|
142
|
1
|
bean.SbyteType = null;
|
143
|
1
|
bean.ByteType = null;
|
144
|
1
|
bean.Int16Type = null;
|
145
|
1
|
bean.Int32Type = null;
|
146
|
1
|
bean.Int64Type = null;
|
147
|
1
|
bean.DecimalType = null;
|
148
|
1
|
bean.SingleType = null;
|
149
|
1
|
bean.DoubleType = null;
|
150
|
1
|
bean.StringType = null;
|
151
|
1
|
bean.DateTimeType = null;
|
152
|
|
|
153
|
1
|
BeanReader reader = new BeanReader(bean);
|
154
|
1
|
DataSet ds = reader.Read();
|
155
|
1
|
DataTable table = ds.Tables[0];
|
156
|
1
|
DataRow row = table.Rows[0];
|
157
|
1
|
DataColumnCollection columns = table.Columns;
|
158
|
|
|
159
|
1
|
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
|
160
|
1
|
Assert.AreEqual(12, columns.Count);
|
161
|
|
|
162
|
1
|
Assert.AreEqual(DBNull.Value, row["id"]);
|
163
|
1
|
Assert.AreEqual(DBNull.Value, row["booltype"]);
|
164
|
1
|
Assert.AreEqual(DBNull.Value, row["sbytetype"]);
|
165
|
1
|
Assert.AreEqual(DBNull.Value, row["bytetype"]);
|
166
|
1
|
Assert.AreEqual(DBNull.Value, row["int16type"]);
|
167
|
1
|
Assert.AreEqual(DBNull.Value, row["int32type"]);
|
168
|
1
|
Assert.AreEqual(DBNull.Value, row["int64type"]);
|
169
|
1
|
Assert.AreEqual(DBNull.Value, row["decimaltype"]);
|
170
|
1
|
Assert.AreEqual(DBNull.Value, row["singletype"]);
|
171
|
1
|
Assert.AreEqual(DBNull.Value, row["doubletype"]);
|
172
|
1
|
Assert.AreEqual(DBNull.Value, row["stringtype"]);
|
173
|
1
|
Assert.AreEqual(DBNull.Value, row["datetimetype"]);
|
174
|
|
|
175
|
1
|
Assert.AreEqual(typeof(long), columns["id"].DataType);
|
176
|
1
|
Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
|
177
|
1
|
Assert.AreEqual(typeof(sbyte), columns["sbytetype"].DataType);
|
178
|
1
|
Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
|
179
|
1
|
Assert.AreEqual(typeof(short), columns["int16type"].DataType);
|
180
|
1
|
Assert.AreEqual(typeof(int), columns["int32type"].DataType);
|
181
|
1
|
Assert.AreEqual(typeof(long), columns["int64type"].DataType);
|
182
|
1
|
Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
|
183
|
1
|
Assert.AreEqual(typeof(float), columns["singletype"].DataType);
|
184
|
1
|
Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
|
185
|
1
|
Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
|
186
|
1
|
Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
|
187
|
|
}
|
188
|
|
|
189
|
1
|
[Test]
|
190
|
|
public void TestReadNullableType()
|
191
|
|
{
|
192
|
1
|
NullableBasicTypeBean bean = new NullableBasicTypeBean();
|
193
|
1
|
bean.Id = 1;
|
194
|
1
|
bean.BoolType = true;
|
195
|
1
|
bean.SbyteType = SByte.MaxValue;
|
196
|
1
|
bean.ByteType = Byte.MaxValue;
|
197
|
1
|
bean.Int16Type = Int16.MaxValue;
|
198
|
1
|
bean.Int32Type = Int32.MaxValue;
|
199
|
1
|
bean.Int64Type = Int64.MaxValue;
|
200
|
1
|
bean.DecimalType = Decimal.MaxValue;
|
201
|
1
|
bean.SingleType = Single.MaxValue;
|
202
|
1
|
bean.DoubleType = Double.MaxValue;
|
203
|
1
|
bean.StringType = "abcde";
|
204
|
1
|
bean.DateTimeType = new DateTime(1999, 12, 31);
|
205
|
|
|
206
|
1
|
BeanReader reader = new BeanReader(bean);
|
207
|
1
|
DataSet ds = reader.Read();
|
208
|
1
|
DataTable table = ds.Tables[0];
|
209
|
1
|
DataRow row = table.Rows[0];
|
210
|
1
|
DataColumnCollection columns = table.Columns;
|
211
|
|
|
212
|
1
|
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
|
213
|
1
|
Assert.AreEqual(12, columns.Count);
|
214
|
|
|
215
|
1
|
Assert.AreEqual(1, row["id"]);
|
216
|
1
|
Assert.AreEqual(true, row["booltype"]);
|
217
|
1
|
Assert.AreEqual(SByte.MaxValue, row["sbytetype"]);
|
218
|
1
|
Assert.AreEqual(Byte.MaxValue, row["bytetype"]);
|
219
|
1
|
Assert.AreEqual(Int16.MaxValue, row["int16type"]);
|
220
|
1
|
Assert.AreEqual(Int32.MaxValue, row["int32type"]);
|
221
|
1
|
Assert.AreEqual(Int64.MaxValue, row["int64type"]);
|
222
|
1
|
Assert.AreEqual(Decimal.MaxValue, row["decimaltype"]);
|
223
|
1
|
Assert.AreEqual(Single.MaxValue, row["singletype"]);
|
224
|
1
|
Assert.AreEqual(Double.MaxValue, row["doubletype"]);
|
225
|
1
|
Assert.AreEqual("abcde", row["stringtype"]);
|
226
|
1
|
Assert.AreEqual(new DateTime(1999, 12, 31), row["datetimetype"]);
|
227
|
|
|
228
|
1
|
Assert.AreEqual(typeof(long), columns["id"].DataType);
|
229
|
1
|
Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
|
230
|
1
|
Assert.AreEqual(typeof(sbyte), columns["sbytetype"].DataType);
|
231
|
1
|
Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
|
232
|
1
|
Assert.AreEqual(typeof(short), columns["int16type"].DataType);
|
233
|
1
|
Assert.AreEqual(typeof(int), columns["int32type"].DataType);
|
234
|
1
|
Assert.AreEqual(typeof(long), columns["int64type"].DataType);
|
235
|
1
|
Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
|
236
|
1
|
Assert.AreEqual(typeof(float), columns["singletype"].DataType);
|
237
|
1
|
Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
|
238
|
1
|
Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
|
239
|
1
|
Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
|
240
|
|
}
|
241
|
|
|
242
|
1
|
[Test]
|
243
|
|
public void TestReadNullableTypeNullValue()
|
244
|
|
{
|
245
|
1
|
NullableBasicTypeBean bean = new NullableBasicTypeBean();
|
246
|
1
|
bean.Id = null;
|
247
|
1
|
bean.BoolType = null;
|
248
|
1
|
bean.SbyteType = null;
|
249
|
1
|
bean.ByteType = null;
|
250
|
1
|
bean.Int16Type = null;
|
251
|
1
|
bean.Int32Type = null;
|
252
|
1
|
bean.Int64Type = null;
|
253
|
1
|
bean.DecimalType = null;
|
254
|
1
|
bean.SingleType = null;
|
255
|
1
|
bean.DoubleType = null;
|
256
|
1
|
bean.StringType = null;
|
257
|
1
|
bean.DateTimeType = null;
|
258
|
|
|
259
|
1
|
BeanReader reader = new BeanReader(bean);
|
260
|
1
|
DataSet ds = reader.Read();
|
261
|
1
|
DataTable table = ds.Tables[0];
|
262
|
1
|
DataRow row = table.Rows[0];
|
263
|
1
|
DataColumnCollection columns = table.Columns;
|
264
|
|
|
265
|
1
|
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
|
266
|
1
|
Assert.AreEqual(12, columns.Count);
|
267
|
|
|
268
|
1
|
Assert.AreEqual(DBNull.Value, row["id"]);
|
269
|
1
|
Assert.AreEqual(DBNull.Value, row["booltype"]);
|
270
|
1
|
Assert.AreEqual(DBNull.Value, row["sbytetype"]);
|
271
|
1
|
Assert.AreEqual(DBNull.Value, row["bytetype"]);
|
272
|
1
|
Assert.AreEqual(DBNull.Value, row["int16type"]);
|
273
|
1
|
Assert.AreEqual(DBNull.Value, row["int32type"]);
|
274
|
1
|
Assert.AreEqual(DBNull.Value, row["int64type"]);
|
275
|
1
|
Assert.AreEqual(DBNull.Value, row["decimaltype"]);
|
276
|
1
|
Assert.AreEqual(DBNull.Value, row["singletype"]);
|
277
|
1
|
Assert.AreEqual(DBNull.Value, row["doubletype"]);
|
278
|
1
|
Assert.AreEqual(DBNull.Value, row["stringtype"]);
|
279
|
1
|
Assert.AreEqual(DBNull.Value, row["datetimetype"]);
|
280
|
|
|
281
|
1
|
Assert.AreEqual(typeof(long), columns["id"].DataType);
|
282
|
1
|
Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
|
283
|
1
|
Assert.AreEqual(typeof(sbyte), columns["sbytetype"].DataType);
|
284
|
1
|
Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
|
285
|
1
|
Assert.AreEqual(typeof(short), columns["int16type"].DataType);
|
286
|
1
|
Assert.AreEqual(typeof(int), columns["int32type"].DataType);
|
287
|
1
|
Assert.AreEqual(typeof(long), columns["int64type"].DataType);
|
288
|
1
|
Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
|
289
|
1
|
Assert.AreEqual(typeof(float), columns["singletype"].DataType);
|
290
|
1
|
Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
|
291
|
1
|
Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
|
292
|
1
|
Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
|
293
|
|
}
|
294
|
|
|
295
|
1
|
[Test]
|
296
|
|
public void TestReadSqlType()
|
297
|
|
{
|
298
|
1
|
SqlTypeBasicTypeBean bean = new SqlTypeBasicTypeBean();
|
299
|
1
|
bean.Id = 1;
|
300
|
1
|
bean.BoolType = true;
|
301
|
1
|
bean.ByteType = Byte.MaxValue;
|
302
|
1
|
bean.Int16Type = Int16.MaxValue;
|
303
|
1
|
bean.Int32Type = Int32.MaxValue;
|
304
|
1
|
bean.Int64Type = Int64.MaxValue;
|
305
|
1
|
bean.DecimalType = Decimal.MaxValue;
|
306
|
1
|
bean.SingleType = Single.MaxValue;
|
307
|
1
|
bean.DoubleType = Double.MaxValue;
|
308
|
1
|
bean.StringType = "abcde";
|
309
|
1
|
bean.DateTimeType = new DateTime(1999, 12, 31);
|
310
|
|
|
311
|
1
|
BeanReader reader = new BeanReader(bean);
|
312
|
1
|
DataSet ds = reader.Read();
|
313
|
1
|
DataTable table = ds.Tables[0];
|
314
|
1
|
DataRow row = table.Rows[0];
|
315
|
1
|
DataColumnCollection columns = table.Columns;
|
316
|
|
|
317
|
1
|
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
|
318
|
1
|
Assert.AreEqual(11, columns.Count);
|
319
|
|
|
320
|
1
|
Assert.AreEqual(1, row["id"]);
|
321
|
1
|
Assert.AreEqual(true, row["booltype"]);
|
322
|
1
|
Assert.AreEqual(Byte.MaxValue, row["bytetype"]);
|
323
|
1
|
Assert.AreEqual(Int16.MaxValue, row["int16type"]);
|
324
|
1
|
Assert.AreEqual(Int32.MaxValue, row["int32type"]);
|
325
|
1
|
Assert.AreEqual(Int64.MaxValue, row["int64type"]);
|
326
|
1
|
Assert.AreEqual(Decimal.MaxValue, row["decimaltype"]);
|
327
|
1
|
Assert.AreEqual(Single.MaxValue, row["singletype"]);
|
328
|
1
|
Assert.AreEqual(Double.MaxValue, row["doubletype"]);
|
329
|
1
|
Assert.AreEqual("abcde", row["stringtype"]);
|
330
|
1
|
Assert.AreEqual(new DateTime(1999, 12, 31), row["datetimetype"]);
|
331
|
|
|
332
|
1
|
Assert.AreEqual(typeof(long), columns["id"].DataType);
|
333
|
1
|
Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
|
334
|
1
|
Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
|
335
|
1
|
Assert.AreEqual(typeof(short), columns["int16type"].DataType);
|
336
|
1
|
Assert.AreEqual(typeof(int), columns["int32type"].DataType);
|
337
|
1
|
Assert.AreEqual(typeof(long), columns["int64type"].DataType);
|
338
|
1
|
Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
|
339
|
1
|
Assert.AreEqual(typeof(float), columns["singletype"].DataType);
|
340
|
1
|
Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
|
341
|
1
|
Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
|
342
|
1
|
Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
|
343
|
|
}
|
344
|
|
|
345
|
1
|
[Test]
|
346
|
|
public void TestReadSqlTypeNullValue()
|
347
|
|
{
|
348
|
1
|
SqlTypeBasicTypeBean bean = new SqlTypeBasicTypeBean();
|
349
|
1
|
bean.Id = SqlInt64.Null;
|
350
|
1
|
bean.BoolType = SqlBoolean.Null;
|
351
|
1
|
bean.ByteType = SqlByte.Null;
|
352
|
1
|
bean.Int16Type = SqlInt16.Null;
|
353
|
1
|
bean.Int32Type = SqlInt32.Null;
|
354
|
1
|
bean.Int64Type = SqlInt64.Null;
|
355
|
1
|
bean.DecimalType = SqlDecimal.Null;
|
356
|
1
|
bean.SingleType = SqlSingle.Null;
|
357
|
1
|
bean.DoubleType = SqlDouble.Null;
|
358
|
1
|
bean.StringType = SqlString.Null;
|
359
|
1
|
bean.DateTimeType = SqlDateTime.Null;
|
360
|
|
|
361
|
1
|
BeanReader reader = new BeanReader(bean);
|
362
|
1
|
DataSet ds = reader.Read();
|
363
|
1
|
DataTable table = ds.Tables[0];
|
364
|
1
|
DataRow row = table.Rows[0];
|
365
|
1
|
DataColumnCollection columns = table.Columns;
|
366
|
|
|
367
|
1
|
Assert.AreEqual(DataRowState.Unchanged, row.RowState);
|
368
|
1
|
Assert.AreEqual(11, columns.Count);
|
369
|
|
|
370
|
1
|
Assert.AreEqual(DBNull.Value, row["id"]);
|
371
|
1
|
Assert.AreEqual(DBNull.Value, row["booltype"]);
|
372
|
1
|
Assert.AreEqual(DBNull.Value, row["bytetype"]);
|
373
|
1
|
Assert.AreEqual(DBNull.Value, row["int16type"]);
|
374
|
1
|
Assert.AreEqual(DBNull.Value, row["int32type"]);
|
375
|
1
|
Assert.AreEqual(DBNull.Value, row["int64type"]);
|
376
|
1
|
Assert.AreEqual(DBNull.Value, row["decimaltype"]);
|
377
|
1
|
Assert.AreEqual(DBNull.Value, row["singletype"]);
|
378
|
1
|
Assert.AreEqual(DBNull.Value, row["doubletype"]);
|
379
|
1
|
Assert.AreEqual(DBNull.Value, row["stringtype"]);
|
380
|
1
|
Assert.AreEqual(DBNull.Value, row["datetimetype"]);
|
381
|
|
|
382
|
1
|
Assert.AreEqual(typeof(long), columns["id"].DataType);
|
383
|
1
|
Assert.AreEqual(typeof(bool), columns["booltype"].DataType);
|
384
|
1
|
Assert.AreEqual(typeof(byte), columns["bytetype"].DataType);
|
385
|
1
|
Assert.AreEqual(typeof(short), columns["int16type"].DataType);
|
386
|
1
|
Assert.AreEqual(typeof(int), columns["int32type"].DataType);
|
387
|
1
|
Assert.AreEqual(typeof(long), columns["int64type"].DataType);
|
388
|
1
|
Assert.AreEqual(typeof(decimal), columns["decimaltype"].DataType);
|
389
|
1
|
Assert.AreEqual(typeof(float), columns["singletype"].DataType);
|
390
|
1
|
Assert.AreEqual(typeof(double), columns["doubletype"].DataType);
|
391
|
1
|
Assert.AreEqual(typeof(string), columns["stringtype"].DataType);
|
392
|
1
|
Assert.AreEqual(typeof(DateTime), columns["datetimetype"].DataType);
|
393
|
|
}
|
394
|
|
}
|
395
|
|
}
|
396
|
|
|