File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Linq ;
3+ using System . Threading . Tasks ;
34
45#if NETFX_CORE
56using Microsoft . VisualStudio . TestPlatform . UnitTestFramework ;
@@ -36,6 +37,17 @@ SQLiteConnection CreateDb ()
3637 return db ;
3738 }
3839
40+ async Task < SQLiteAsyncConnection > CreateDbAsync ( )
41+ {
42+ var db = new SQLiteAsyncConnection ( new SQLiteConnectionString ( TestPath . GetTempFileName ( ) ) ) ;
43+ await db . CreateTableAsync < TestTable > ( ) ;
44+ var items = from i in Enumerable . Range ( 0 , Count )
45+ select new TestTable { Datum = 1000 + i , Test = "Hello World" } ;
46+ await db . InsertAllAsync ( items ) ;
47+ Assert . AreEqual ( Count , await db . Table < TestTable > ( ) . CountAsync ( ) ) ;
48+ return db ;
49+ }
50+
3951 [ Test ]
4052 public void DeleteEntityOne ( )
4153 {
@@ -47,6 +59,17 @@ public void DeleteEntityOne ()
4759 Assert . AreEqual ( Count - 1 , db . Table < TestTable > ( ) . Count ( ) ) ;
4860 }
4961
62+ [ Test ]
63+ public async Task DeleteEntityOneAsync ( )
64+ {
65+ var db = await CreateDbAsync ( ) ;
66+
67+ var r = await db . DeleteAsync ( await db . GetAsync < TestTable > ( 1 ) ) ;
68+
69+ Assert . AreEqual ( 1 , r ) ;
70+ Assert . AreEqual ( Count - 1 , await db . Table < TestTable > ( ) . CountAsync ( ) ) ;
71+ }
72+
5073 [ Test ]
5174 public void DeletePKOne ( )
5275 {
You can’t perform that action at this time.
0 commit comments