Mercurial > pub > bltoolkit
comparison HowTo/DataAccess/ScalarSource.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 | |
| 3 using NUnit.Framework; | |
| 4 | |
| 5 using BLToolkit.Data; | |
| 6 using BLToolkit.DataAccess; | |
| 7 | |
| 8 namespace HowTo.DataAccess | |
| 9 { | |
| 10 [TestFixture] | |
| 11 public class ScalarSource | |
| 12 { | |
| 13 public abstract class TestAccessor : DataAccessor | |
| 14 { | |
| 15 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.DataReader)] | |
| 16 public abstract int Scalar_DataReader(); | |
| 17 | |
| 18 [ActionName("Scalar_DataReader")] | |
| 19 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.DataReader, 1)] | |
| 20 public abstract string Scalar_DataReader2(); | |
| 21 | |
| 22 [ActionName("Scalar_DataReader")] | |
| 23 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.DataReader, "stringField")] | |
| 24 public abstract string Scalar_DataReader3(); | |
| 25 | |
| 26 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.OutputParameter)] | |
| 27 public abstract int Scalar_OutputParameter(); | |
| 28 | |
| 29 [ActionName("Scalar_OutputParameter")] | |
| 30 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.OutputParameter, 1)] | |
| 31 public abstract string Scalar_OutputParameter2(); | |
| 32 | |
| 33 [ActionName("Scalar_OutputParameter")] | |
| 34 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.OutputParameter, "outputString")] | |
| 35 public abstract string Scalar_OutputParameter3(); | |
| 36 | |
| 37 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.ReturnValue)] | |
| 38 public abstract int Scalar_ReturnParameter(); | |
| 39 | |
| 40 [ActionName("Scalar_DataReader")] | |
| 41 [/*[a]*/ScalarSource/*[/a]*/(ScalarSourceType.AffectedRows)] | |
| 42 public abstract int Scalar_AffectedRows(); | |
| 43 | |
| 44 public static TestAccessor CreateInstance() | |
| 45 { | |
| 46 return (TestAccessor)CreateInstance(typeof(TestAccessor)); | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 [Test] | |
| 51 public void DataReaderTest() | |
| 52 { | |
| 53 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 54 | |
| 55 int expectedValue = 12345; | |
| 56 int actualValue = ta.Scalar_DataReader(); | |
| 57 | |
| 58 Assert.AreEqual(expectedValue, actualValue); | |
| 59 } | |
| 60 | |
| 61 [Test] | |
| 62 public void DataReader2Test() | |
| 63 { | |
| 64 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 65 | |
| 66 string expectedValue = "54321"; | |
| 67 string actualValue = ta.Scalar_DataReader2(); | |
| 68 | |
| 69 Assert.AreEqual(expectedValue, actualValue); | |
| 70 } | |
| 71 | |
| 72 [Test] | |
| 73 public void DataReader3Test() | |
| 74 { | |
| 75 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 76 | |
| 77 string expectedValue = "54321"; | |
| 78 string actualValue = ta.Scalar_DataReader3(); | |
| 79 | |
| 80 Assert.AreEqual(expectedValue, actualValue); | |
| 81 } | |
| 82 | |
| 83 [Test] | |
| 84 public void OutputParameterTest() | |
| 85 { | |
| 86 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 87 | |
| 88 int expectedValue = 12345; | |
| 89 int actualValue = ta.Scalar_OutputParameter(); | |
| 90 | |
| 91 Assert.AreEqual(expectedValue, actualValue); | |
| 92 } | |
| 93 | |
| 94 [Test] | |
| 95 public void OutputParameter2Test() | |
| 96 { | |
| 97 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 98 | |
| 99 string expectedValue = "54321"; | |
| 100 string actualValue = ta.Scalar_OutputParameter2(); | |
| 101 | |
| 102 Assert.AreEqual(expectedValue, actualValue); | |
| 103 } | |
| 104 | |
| 105 [Test] | |
| 106 public void OutputParameter3Test() | |
| 107 { | |
| 108 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 109 | |
| 110 string expectedValue = "54321"; | |
| 111 string actualValue = ta.Scalar_OutputParameter3(); | |
| 112 | |
| 113 Assert.AreEqual(expectedValue, actualValue); | |
| 114 } | |
| 115 | |
| 116 [Test] | |
| 117 public void ReturnParameterTest() | |
| 118 { | |
| 119 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 120 | |
| 121 int expectedValue = 12345; | |
| 122 int actualValue = ta.Scalar_ReturnParameter(); | |
| 123 | |
| 124 Assert.AreEqual(expectedValue, actualValue); | |
| 125 } | |
| 126 | |
| 127 [Test] | |
| 128 public void AffectedRowsTest() | |
| 129 { | |
| 130 TestAccessor ta = TestAccessor.CreateInstance(); | |
| 131 | |
| 132 int expectedValue = -1; | |
| 133 int actualValue = ta.Scalar_AffectedRows(); | |
| 134 | |
| 135 Assert.AreEqual(expectedValue, actualValue); | |
| 136 } | |
| 137 } | |
| 138 } |
