Mercurial > pub > bltoolkit
comparison UnitTests/Linq/ProviderSpecific/Firebird.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 using BLToolkit.Data.Linq; | |
6 | |
7 using NUnit.Framework; | |
8 | |
9 using UnitTests.Linq.Interface.Model; | |
10 | |
11 namespace Data.Linq.ProviderSpecific | |
12 { | |
13 [TestFixture, Category("Firebird")] | |
14 public class Firebird : TestBase | |
15 { | |
16 [Test] | |
17 public void SequenceInsert([IncludeDataContexts(ProviderName.Firebird)] string context) | |
18 { | |
19 using (var db = new TestDbManager(context)) | |
20 { | |
21 db.GetTable<FirebirdSpecific.SequenceTest>().Where(_ => _.Value == "SeqValue").Delete(); | |
22 db.Insert(new FirebirdSpecific.SequenceTest { Value = "SeqValue" }); | |
23 | |
24 var id = db.GetTable<FirebirdSpecific.SequenceTest>().Single(_ => _.Value == "SeqValue").ID; | |
25 | |
26 db.GetTable<FirebirdSpecific.SequenceTest>().Where(_ => _.ID == id).Delete(); | |
27 | |
28 Assert.AreEqual(0, db.GetTable<FirebirdSpecific.SequenceTest>().Count(_ => _.Value == "SeqValue")); | |
29 } | |
30 } | |
31 | |
32 [Test] | |
33 public void SequenceInsertWithIdentity([IncludeDataContexts(ProviderName.Firebird)] string context) | |
34 { | |
35 using (var db = new TestDbManager(context)) | |
36 { | |
37 db.GetTable<FirebirdSpecific.SequenceTest>().Where(_ => _.Value == "SeqValue").Delete(); | |
38 | |
39 var id1 = Convert.ToInt32(db.InsertWithIdentity(new FirebirdSpecific.SequenceTest { Value = "SeqValue" })); | |
40 var id2 = db.GetTable<FirebirdSpecific.SequenceTest>().Single(_ => _.Value == "SeqValue").ID; | |
41 | |
42 Assert.AreEqual(id1, id2); | |
43 | |
44 db.GetTable<FirebirdSpecific.SequenceTest>().Where(_ => _.ID == id1).Delete(); | |
45 | |
46 Assert.AreEqual(0, db.GetTable<FirebirdSpecific.SequenceTest>().Count(_ => _.Value == "SeqValue")); | |
47 } | |
48 } | |
49 } | |
50 } |