Mercurial > pub > bltoolkit
view UnitTests/Linq/VisualBasicTest.cs @ 5:f7d63a092920
Исправлено условие Where в тех случаях, когда репозитарий не является генериком
author | cin |
---|---|
date | Tue, 10 Mar 2015 16:02:11 +0300 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
using System; using System.Linq; using BLToolkit.Data.DataProvider; using NUnit.Framework; namespace Data.Linq { using Model; [TestFixture] public class VisualBasicTest : TestBase { [Test] public void CompareString() { ForEachProvider(db => AreEqual( from p in db.Person where p.FirstName == "John" select p, CompilerServices.CompareString(db))); } [Test] public void CompareString1() { ForEachProvider(db => { var str = CompilerServices.CompareString(db).ToString(); Assert.That(str.IndexOf("CASE"), Is.EqualTo(-1)); }); } [Test] public void ParameterName() { ForEachProvider(db => AreEqual( from p in Parent where p.ParentID == 1 select p, VisualBasicCommon.ParamenterName(db))); } [Test] public void SearchCondition1() { ForEachProvider( new[] { ProviderName.Access }, db => AreEqual( from t in Types where !t.BoolValue && (t.SmallIntValue == 5 || t.SmallIntValue == 7 || (t.SmallIntValue | 2) == 10) select t, VisualBasicCommon.SearchCondition1(db))); } [Test] public void SearchCondition2([IncludeDataContexts("Northwind")] string context) { using (var db = new NorthwindDB()) { AreEqual( from cust in Customer where cust.Orders.Count > 0 && cust.CompanyName.StartsWith("H") select cust.CustomerID, VisualBasicCommon.SearchCondition2(db)); } } } }