comparison UnitTests/CS/DataAccess/XmlTypeTest.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.Collections.Generic;
2
3 using NUnit.Framework;
4
5 using BLToolkit.DataAccess;
6 using BLToolkit.Mapping;
7
8 namespace DataAccess
9 {
10 [TestFixture]
11 public class XmlTypeTest
12 {
13 public class TestObject
14 {
15 [MapField("DataTypeID")]
16 public int ID;
17
18 [MapField("Xml_")]
19 public string Xml;
20 }
21
22 public abstract class TestAccessor : DataAccessor
23 {
24 [SqlQuery("Select * FROM DataTypeTest")]
25 public abstract List<TestObject> LoadAll();
26
27 [TestQuery(
28 SqlText = "SELECT * FROM DataTypeTest WHERE DataTypeID=@ID",
29 OracleText = "SELECT * FROM DataTypeTest WHERE DataTypeID=:ID")]
30 public abstract TestObject LoadById(int ID);
31
32 }
33
34 [Test]
35 public void Test()
36 {
37 TestAccessor ta = (TestAccessor)DataAccessor.CreateInstance(typeof(TestAccessor));
38 TestObject o = ta.LoadById(2);
39
40 Assert.IsNotNull(o);
41 Assert.IsNotNull(o.Xml);
42
43 List<TestObject> lst = ta.LoadAll();
44 Assert.IsNotEmpty(lst);
45 Assert.IsNotNull(lst[0].Xml);
46 }
47 }
48 }