comparison UnitTests/CS/Data/NullableParameter.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.Data;
3
4 using NUnit.Framework;
5
6 using BLToolkit.Data;
7 using BLToolkit.Mapping;
8
9 namespace Data
10 {
11 [TestFixture]
12 public class NullableParameter
13 {
14 public class NullableInt
15 {
16 [NullValue(-1)]
17 public int I;
18 public int II;
19 }
20
21 [Test]
22 public void Test()
23 {
24 const int testValue = 0;
25
26 NullableInt ni = new NullableInt();
27
28 ni.I = testValue;
29 ni.II = testValue;
30
31 using (DbManager db = new DbManager())
32 {
33 IDbDataParameter[] ps = db.CreateParameters(ni);
34
35 foreach (IDbDataParameter p in ps)
36 {
37 switch (p.ParameterName)
38 {
39 case "@I":
40 Assert.AreEqual(testValue, p.Value);
41 break;
42 case "@II":
43 Assert.AreEqual(testValue, p.Value);
44 break;
45 }
46 }
47 }
48 }
49 }
50 }