Mercurial > pub > bltoolkit
comparison HowTo/DataAccess/Direction.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 NUnit.Framework; | |
3 using BLToolkit.DataAccess; | |
4 | |
5 namespace HowTo.DataAccess | |
6 { | |
7 [TestFixture] | |
8 public class DirectionTest | |
9 { | |
10 public abstract class PersonAccessor : DataAccessor | |
11 { | |
12 [SprocName("Person_Insert_OutputParameter")] | |
13 public abstract void Insert_OutputParameter([/*[a]*/Direction.Output/*[/a]*/("PERSONID")] Person p); | |
14 | |
15 [SprocName("Scalar_ReturnParameter")] | |
16 public abstract void Insert_ReturnParameter( | |
17 [/*[a]*/Direction.ReturnValue/*[/a]*/("@PersonID"), | |
18 /*[a]*/Direction.Ignore/*[/a]*/("PersonID", "FirstName", "LastName", "MiddleName", "Gender")] Person p); | |
19 | |
20 [SprocName("Scalar_ReturnParameter")] | |
21 public abstract void Insert_ReturnParameter2( | |
22 [/*[a]*/Direction.ReturnValue/*[/a]*/("ID"), | |
23 /*[a]*/Direction.Ignore/*[/a]*/("PersonID", "FirstName", "LastName", "MiddleName", "Gender")] Person p); | |
24 } | |
25 | |
26 PersonAccessor Accessor | |
27 { | |
28 get { return DataAccessor.CreateInstance<PersonAccessor>(); } | |
29 } | |
30 | |
31 [Test] | |
32 public void TestOutputParameter() | |
33 { | |
34 Person p = new Person { FirstName = "Crazy", LastName = "Frog", Gender = Gender.Other }; | |
35 | |
36 Accessor.Insert_OutputParameter(p); | |
37 | |
38 Assert.IsTrue(p.ID > 0); | |
39 | |
40 new SprocQuery().Delete(p); | |
41 } | |
42 | |
43 [Test] | |
44 public void TestReturnParameter() | |
45 { | |
46 Person p = new Person(); | |
47 | |
48 Accessor.Insert_ReturnParameter(p); | |
49 | |
50 Assert.AreEqual(12345, p.ID); | |
51 } | |
52 | |
53 [Test] | |
54 public void TestReturnParameter2() | |
55 { | |
56 Person p = new Person(); | |
57 | |
58 Accessor.Insert_ReturnParameter2(p); | |
59 | |
60 Assert.AreEqual(12345, p.ID); | |
61 } | |
62 } | |
63 } |