0
|
1 using System;
|
|
2 using System.Data;
|
|
3
|
|
4 using NUnit.Framework;
|
|
5
|
|
6 using BLToolkit.Data;
|
|
7 using BLToolkit.DataAccess;
|
|
8
|
|
9 namespace HowTo.DataAccess
|
|
10 {
|
|
11 [TestFixture]
|
|
12 public class Param
|
|
13 {
|
|
14 public abstract class TestAccessor : DataAccessor
|
|
15 {
|
|
16 [SqlQuery("SELECT {0} = {1} FROM Person WHERE PersonID = 1")]
|
|
17 public abstract void SelectJohn(
|
|
18 [/*[a]*/ParamSize/*[/a]*/(50), /*[a]*/ParamDbType/*[/a]*/(DbType.String)] out string name,
|
|
19 [Format] string paramName,
|
|
20 [Format] string fieldName);
|
|
21 }
|
|
22
|
|
23 [Test]
|
|
24 public void AccessorTest()
|
|
25 {
|
|
26 using (DbManager db = new DbManager())
|
|
27 {
|
|
28 TestAccessor ta = DataAccessor.CreateInstance<TestAccessor>(db);
|
|
29
|
|
30 string actualName;
|
|
31
|
|
32 ta.SelectJohn(out actualName, "@name", "FirstName");
|
|
33
|
|
34 Assert.AreEqual("John", actualName);
|
|
35 }
|
|
36 }
|
|
37 }
|
|
38 }
|