Mercurial > pub > bltoolkit
view UnitTests/Linq/ExplicitInterfaceTests.cs @ 3:1ef98bd70424
!bug 100 +3h
Исправление проблемы BLToolkit + mono 3.4
author | cin |
---|---|
date | Fri, 22 Aug 2014 17:34:46 +0400 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
using System; using System.Linq; using BLToolkit.Data.Linq; using BLToolkit.DataAccess; using BLToolkit.Mapping; using NUnit.Framework; namespace Data.Linq { [TestFixture] public class ExplicitInterfaceTests : TestBase { interface IDate { DateTime? Date { get; } } interface IDate2 { DateTime? Date { get; set; } } [TableName("LinqDataTypes")] class TestTable : IDate { [MapField("GuidValue")] Guid? GuidValue { get; set; } [MapField("BoolValue")] public bool? Bit { get; set; } private DateTime? _date; [MapField("DateTimeValue", Storage = "_date")] DateTime? IDate.Date { get { return _date; } } } [TableName("LinqDataTypes")] public class TestTable2 : IDate { [MapField("GuidValue")] Guid? GuidValue { get; set; } [MapField("BoolValue")] public bool? Bit { get; set; } private DateTime? _date; [MapField("DateTimeValue", Storage = "_date")] DateTime? IDate.Date { get { return _date; } } } [TableName("LinqDataTypes")] public class TestTable3 : IDate2 { [MapField("GuidValue")] Guid? GuidValue { get; set; } [MapField("BoolValue")] public bool? Bit { get; set; } [MapField("DateTimeValue")] DateTime? IDate2.Date { get; set; } } static IQueryable<T> SelectNoDate<T>(IQueryable<T> items) where T : IDate { return items.Where(i => i.Date == null); } static IQueryable<T> SelectNoDate2<T>(IQueryable<T> items) where T : IDate2 { return items.Where(i => i.Date == null); } [Test] public void ExplicitInterface1() { using (var db = new TestDbManager()) { var result = SelectNoDate(db.GetTable<TestTable>()).ToList(); } } [Test] public void ExplicitInterface2() { using (var db = new TestDbManager()) { var result = SelectNoDate(db.GetTable<TestTable2>()).ToList(); } } [Test] public void ExplicitInterface3() { using (var db = new TestDbManager()) { var result = SelectNoDate2(db.GetTable<TestTable3>()).ToList(); } } } }