0
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3
|
|
4 using NUnit.Framework;
|
|
5
|
|
6 using BLToolkit.Data;
|
|
7
|
|
8 namespace HowTo.Data
|
|
9 {
|
|
10 using DataAccess;
|
|
11
|
|
12 [TestFixture]
|
|
13 public class ExecuteScalarList
|
|
14 {
|
|
15 List<string> GetNameList1()
|
|
16 {
|
|
17 using (DbManager db = new DbManager())
|
|
18 {
|
|
19 return db
|
|
20 .SetCommand("SELECT FirstName FROM Person")
|
|
21 ./*[a]*/ExecuteScalarList/*[/a]*/<string>();
|
|
22 }
|
|
23 }
|
|
24
|
|
25 [Test]
|
|
26 public void Test1()
|
|
27 {
|
|
28 List<string> list = GetNameList1();
|
|
29
|
|
30 Assert.AreNotEqual(0, list.Count);
|
|
31 Assert.IsNotNull(list[0]);
|
|
32 }
|
|
33
|
|
34 List<string> GetNameList2()
|
|
35 {
|
|
36 using (DbManager db = new DbManager())
|
|
37 {
|
|
38 return db
|
|
39 .SetCommand("SELECT * FROM Person")
|
|
40 ./*[a]*/ExecuteScalarList/*[/a]*/<string>(/*[a]*/"FirstName"/*[/a]*/);
|
|
41 }
|
|
42 }
|
|
43
|
|
44 [Test]
|
|
45 public void Test2()
|
|
46 {
|
|
47 List<string> list = GetNameList2();
|
|
48
|
|
49 Assert.AreNotEqual(0, list.Count);
|
|
50 Assert.IsNotNull(list[0]);
|
|
51 }
|
|
52 }
|
|
53 }
|