comparison UnitTests/CS/DataAccess/XmlExtension.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.DataAccess;
6 using BLToolkit.Mapping;
7 using BLToolkit.Reflection.Extension;
8 using BLToolkit.Data;
9
10 namespace DataAccess
11 {
12 [TestFixture]
13 public class XmlExtension
14 {
15 public class Person1
16 {
17 [MapField("PersonID")] public int ID;
18 [MapField("FirstName")] public string Name;
19 }
20
21 [Test]
22 public void Test()
23 {
24 using (DbManager db = new DbManager())
25 {
26 SqlQuery sq = new SqlQuery(db);
27 sq.Extensions = TypeExtension.GetExtensions(@"XmlExtension.xml");
28 Assert.IsNotNull(sq.Extensions["Person1"]);
29
30 Person1 ps = (Person1)sq.SelectByKey(typeof(Person1), 1);
31 Assert.IsNotNull(ps);
32 }
33 }
34
35 [Test]
36 public void GenericsTest()
37 {
38 using (DbManager db = new DbManager())
39 {
40 SqlQuery<Person1> sq = new SqlQuery<Person1>(db);
41 sq.Extensions = TypeExtension.GetExtensions(@"XmlExtension.xml");
42 Assert.IsNotNull(sq.Extensions["Person1"]);
43
44 Person1 ps = sq.SelectByKey(1);
45 Assert.IsNotNull(ps);
46 }
47 }
48 }
49 }
50