55using  Unosquare . Labs . LiteLib . Tests . Database ; 
66using  Unosquare . Labs . LiteLib . Tests . Helpers ; 
77#if MONO 
8-     using  Mono . Data . Sqlite ; 
8+ using  Mono . Data . Sqlite ; 
9+ #elif NET46 
10+ using  System . Data . SQLite ; 
911#else
1012using  Microsoft . Data . Sqlite ; 
1113#endif
@@ -48,7 +50,7 @@ public void SelectDataWithParameters()
4850                        context . Orders . Insert ( item ) ; 
4951                    } 
5052
51-                     var  entities  =  context . Orders . Select ( "CustomerName = @CustomerName" ,  new  {   CustomerName  =  "John"   } ) ; 
53+                     var  entities  =  context . Orders . Select ( "CustomerName = @CustomerName" ,  new  { CustomerName  =  "John" } ) ; 
5254                    foreach  ( var  item  in  entities ) 
5355                    { 
5456                        Assert . AreEqual ( "John" ,  item . CustomerName ) ; 
@@ -65,14 +67,17 @@ public void SelectWithBadParameters_ThrowsException()
6567                    { 
6668                        context . Orders . Insert ( item ) ; 
6769                    } 
68- 
70+ #if NET46 
71+                     Assert . Throws < SQLiteException > ( ( )  => 
72+ #else
6973                    Assert . Throws < SqliteException > ( ( )  => 
74+ #endif
7075                    { 
71-                         var  entities  =  context . Orders . Select ( "Customer = @CustomerName" ,  new  {   CustomerName  =  "John"   } ) ; 
76+                         var  entities  =  context . Orders . Select ( "Customer = @CustomerName" ,  new  { CustomerName  =  "John" } ) ; 
7277                    } ) ; 
7378                } 
7479            } 
75-              
80+ 
7681            [ Test ] 
7782            public void  SelectingFirstOrDefault( ) 
7883            { 
@@ -119,7 +124,8 @@ public void DeletingUsingParams()
119124                        context . Orders . Insert ( item ) ; 
120125                    } 
121126
122-                     var  deletedData  =  context . Orders . Delete ( "CustomerName = @CustomerName" ,  new  {  CustomerName  =  "Peter"  } ) ; 
127+                     var  deletedData  = 
128+                         context . Orders . Delete ( "CustomerName = @CustomerName" ,  new  { CustomerName  =  "Peter" } ) ; 
123129                    Assert . AreEqual ( deletedData ,  TestHelper . DataSource . Count ( x =>  x . CustomerName  ==  "Peter" ) ) ; 
124130                } 
125131            } 
@@ -134,8 +140,14 @@ public void DeletingUsingInvalidParams_TrhowsSqliteException()
134140                        context . Orders . Insert ( item ) ; 
135141                    } 
136142
137-                     Assert . Throws < SqliteException > ( ( )  =>  { 
138-                         var  deletedData  =  context . Orders . Delete ( "Customer = @CustomerName" ,  new  {  CustomerName  =  "Peter"  } ) ; 
143+ #if NET46 
144+                     Assert . Throws < SQLiteException > ( ( )  => 
145+ #else
146+                     Assert . Throws < SqliteException > ( ( )  => 
147+ #endif
148+                     { 
149+                         var  deletedData  = 
150+                             context . Orders . Delete ( "Customer = @CustomerName" ,  new  { CustomerName  =  "Peter" } ) ; 
139151                    } ) ; 
140152                } 
141153            } 
@@ -165,7 +177,11 @@ public void InsertUsingUnique_ThrowsSqliteException()
165177                        context . Orders . Insert ( item ) ; 
166178                    } 
167179
168-                     Assert . Throws < SqliteException > ( delegate 
180+ #if NET46 
181+                     Assert . Throws < SQLiteException > ( ( )  => 
182+ #else
183+                     Assert . Throws < SqliteException > ( ( )  => 
184+ #endif
169185                    { 
170186                        var  newOrder  =  new  Order 
171187                        { 
@@ -178,13 +194,17 @@ public void InsertUsingUnique_ThrowsSqliteException()
178194                    } ) ; 
179195                } 
180196            } 
181-              
197+ 
182198            [ Test ] 
183199            public void  InsertingWithOutOfRangeString_ThrowsSqliteException( ) 
184200            { 
185201                using  ( var  context  =  new  TestDbContext ( nameof ( InsertingWithOutOfRangeString_ThrowsSqliteException ) ) ) 
186202                { 
187-                     Assert . Throws < SqliteException > ( delegate 
203+ #if NET46
204+                     Assert. Throws < SQLiteException > ( ( )  => 
205+ #else
206+                     Assert . Throws < SqliteException > ( ( )  => 
207+ #endif
188208                    { 
189209                        context . Orders . Insert ( new  Order 
190210                        { 
@@ -213,7 +233,7 @@ public void InsertingDataList()
213233            [ Test ] 
214234            public  void  InsertingEmptyDataList_TrhowsArgumentException ( ) 
215235            { 
216-                 Assert . Throws ( typeof ( ArgumentNullException ) ,   ( )  => 
236+                 Assert . Throws < ArgumentNullException > ( ( )  => 
217237                { 
218238                    using  ( var  context  =  new  TestDbContext ( nameof ( InsertingEmptyDataList_TrhowsArgumentException ) ) ) 
219239                    { 
@@ -235,14 +255,15 @@ public void UpdatingEntities()
235255                        context . Orders . Insert ( item ) ; 
236256                    } 
237257
238-                     var  list  =  context . Orders . Select ( "CustomerName = @CustomerName" ,  new  {   CustomerName  =  "John"   } ) ; 
258+                     var  list  =  context . Orders . Select ( "CustomerName = @CustomerName" ,  new  { CustomerName  =  "John" } ) ; 
239259                    foreach  ( var  item  in  list ) 
240260                    { 
241261                        item . ShipperCity  =  "Atlanta" ; 
242262                        context . Orders . Update ( item ) ; 
243263                    } 
244264
245-                     var  updatedList  =  context . Orders . Select ( "ShipperCity = @ShipperCity" ,  new  {  ShipperCity  =  "Atlanta"  } ) ; 
265+                     var  updatedList  = 
266+                         context . Orders . Select ( "ShipperCity = @ShipperCity" ,  new  { ShipperCity  =  "Atlanta" } ) ; 
246267                    foreach  ( var  item  in  updatedList ) 
247268                    { 
248269                        Assert . AreEqual ( "Atlanta" ,  item . ShipperCity ) ; 
@@ -298,7 +319,7 @@ public void SetEntity()
298319                { 
299320                    var  names  =  context . GetSetNames ( ) ; 
300321                    Assert . IsNotNull ( names ) ; 
301-                     Assert . AreEqual ( names ,  new [ ]  {   nameof ( context . Orders ) ,  nameof ( context . Warehouses )   } ) ; 
322+                     Assert . AreEqual ( names ,  new [ ]  { nameof ( context . Orders ) ,  nameof ( context . Warehouses ) } ) ; 
302323
303324                    var  orders  =  context . Set < Order > ( ) ; 
304325                    var  ordersByName  =  context . Set ( typeof ( Order ) ) ; 
@@ -330,7 +351,7 @@ public void SelectFromSetname()
330351            [ Test ] 
331352            public  void  InvalidSetname_ThrowsArgumentOutOfRangeException ( ) 
332353            { 
333-                 Assert . Throws ( typeof ( System . ArgumentOutOfRangeException ) ,   ( )  => 
354+                 Assert . Throws < ArgumentOutOfRangeException > ( ( )  => 
334355                { 
335356                    using  ( var  context  =  new  TestDbContext ( nameof ( InvalidSetname_ThrowsArgumentOutOfRangeException ) ) ) 
336357                    { 
@@ -389,12 +410,13 @@ public void UpdateFromSetname()
389410                        item . ShipperCity  =  "Atlanta" ; 
390411                        context . Update ( item ) ; 
391412                    } 
392-                     var  updatedItems  =  context . Orders . Select ( "ShipperCity = @ShipperCity" ,  new  {  ShipperCity  =  "Atlanta"  } ) ; 
413+                     var  updatedItems  = 
414+                         context . Orders . Select ( "ShipperCity = @ShipperCity" ,  new  { ShipperCity  =  "Atlanta" } ) ; 
393415                    Assert . AreEqual ( TestHelper . DataSource . Length ,  updatedItems . Count ( ) ) ; 
394416                } 
395417            } 
396418        } 
397-                  
419+ 
398420        public  class  Qerytest  :  DbContextFixture
399421        { 
400422            [ Test ] 
@@ -414,7 +436,7 @@ public void SelectingData()
414436
415437                    var  selectedData  = 
416438                        context . Query < Order > ( $ "{ context . Orders . SelectDefinition }  WHERE CustomerName = @CustomerName", 
417-                             new  Order  {   CustomerName  =  "Margarita"   } ) ; 
439+                             new  Order  { CustomerName  =  "Margarita" } ) ; 
418440
419441                    foreach  ( var  item  in  selectedData ) 
420442                    { 
@@ -438,10 +460,16 @@ public void UsingBadQuery_ThrowsSqliteException()
438460                        } 
439461                    } 
440462
441-                     Assert . Throws < SqliteException > ( ( )  =>  { 
463+ #if NET46 
464+                     Assert . Throws < SQLiteException > ( ( )  => 
465+ #else
466+                     Assert . Throws < SqliteException > ( ( )  => 
467+ #endif
468+                     { 
442469                        var  selectedData  = 
443-                             context . Query < Order > ( $ "{ context . Orders . UpdateDefinition }  WHERE CustomerName = @CustomerName", 
444-                                 new  Order  {  CustomerName  =  "Margarita"  } ) ; 
470+                             context . Query < Order > ( 
471+                                 $ "{ context . Orders . UpdateDefinition }  WHERE CustomerName = @CustomerName", 
472+                                 new  Order  { CustomerName  =  "Margarita" } ) ; 
445473
446474                    } ) ; 
447475                } 
0 commit comments