comparison UnitTests/Linq/VisualBasicTest.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 using System.Linq;
3
4 using BLToolkit.Data.DataProvider;
5
6 using NUnit.Framework;
7
8 namespace Data.Linq
9 {
10 using Model;
11
12 [TestFixture]
13 public class VisualBasicTest : TestBase
14 {
15 [Test]
16 public void CompareString()
17 {
18 ForEachProvider(db => AreEqual(
19 from p in db.Person where p.FirstName == "John" select p,
20 CompilerServices.CompareString(db)));
21 }
22
23 [Test]
24 public void CompareString1()
25 {
26 ForEachProvider(db =>
27 {
28 var str = CompilerServices.CompareString(db).ToString();
29 Assert.That(str.IndexOf("CASE"), Is.EqualTo(-1));
30 });
31 }
32
33 [Test]
34 public void ParameterName()
35 {
36 ForEachProvider(db => AreEqual(
37 from p in Parent where p.ParentID == 1 select p,
38 VisualBasicCommon.ParamenterName(db)));
39 }
40
41 [Test]
42 public void SearchCondition1()
43 {
44 ForEachProvider(
45 new[] { ProviderName.Access },
46 db => AreEqual(
47 from t in Types
48 where !t.BoolValue && (t.SmallIntValue == 5 || t.SmallIntValue == 7 || (t.SmallIntValue | 2) == 10)
49 select t,
50 VisualBasicCommon.SearchCondition1(db)));
51 }
52
53 [Test]
54 public void SearchCondition2([IncludeDataContexts("Northwind")] string context)
55 {
56 using (var db = new NorthwindDB())
57 {
58 AreEqual(
59 from cust in Customer
60 where cust.Orders.Count > 0 && cust.CompanyName.StartsWith("H")
61 select cust.CustomerID,
62 VisualBasicCommon.SearchCondition2(db));
63 }
64 }
65 }
66 }