Mercurial > pub > bltoolkit
diff UnitTests/CS/DataAccess/XmlExtension.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UnitTests/CS/DataAccess/XmlExtension.cs Thu Mar 27 21:46:09 2014 +0400 @@ -0,0 +1,50 @@ +using System; + +using NUnit.Framework; + +using BLToolkit.DataAccess; +using BLToolkit.Mapping; +using BLToolkit.Reflection.Extension; +using BLToolkit.Data; + +namespace DataAccess +{ + [TestFixture] + public class XmlExtension + { + public class Person1 + { + [MapField("PersonID")] public int ID; + [MapField("FirstName")] public string Name; + } + + [Test] + public void Test() + { + using (DbManager db = new DbManager()) + { + SqlQuery sq = new SqlQuery(db); + sq.Extensions = TypeExtension.GetExtensions(@"XmlExtension.xml"); + Assert.IsNotNull(sq.Extensions["Person1"]); + + Person1 ps = (Person1)sq.SelectByKey(typeof(Person1), 1); + Assert.IsNotNull(ps); + } + } + + [Test] + public void GenericsTest() + { + using (DbManager db = new DbManager()) + { + SqlQuery<Person1> sq = new SqlQuery<Person1>(db); + sq.Extensions = TypeExtension.GetExtensions(@"XmlExtension.xml"); + Assert.IsNotNull(sq.Extensions["Person1"]); + + Person1 ps = sq.SelectByKey(1); + Assert.IsNotNull(ps); + } + } + } +} +