File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,42 @@ public void InlineTable()
164164 db . Drop ( "Transaction" ) ;
165165 }
166166
167+ [ Fact ]
168+ public void ExistsShouldReturnFalseForEmptyTable ( )
169+ {
170+ var db = DB ( ) . Create ( "Transaction" , new [ ] {
171+ "Id INT PRIMARY KEY AUTO_INCREMENT" ,
172+ "Amount int NOT NULL" ,
173+ "Date DATE NOT NULL" ,
174+ } ) ;
175+
176+ var exists = db . Query ( "Transaction" ) . Exists ( ) ;
177+ Assert . Equal ( false , exists ) ;
178+
179+ db . Drop ( "Transaction" ) ;
180+ }
181+
182+ [ Fact ]
183+ public void ExistsShouldReturnTrueForNonEmptyTable ( )
184+ {
185+ var db = DB ( ) . Create ( "Transaction" , new [ ] {
186+ "Id INT PRIMARY KEY AUTO_INCREMENT" ,
187+ "Amount int NOT NULL" ,
188+ "Date DATE NOT NULL" ,
189+ } ) ;
190+
191+ db . Query ( "Transaction" ) . Insert ( new
192+ {
193+ Date = "2022-01-01" ,
194+ Amount = 10
195+ } ) ;
196+
197+ var exists = db . Query ( "Transaction" ) . Exists ( ) ;
198+ Assert . Equal ( true , exists ) ;
199+
200+ db . Drop ( "Transaction" ) ;
201+ }
202+
167203 QueryFactory DB ( )
168204 {
169205 var host = System . Environment . GetEnvironmentVariable ( "SQLKATA_MYSQL_HOST" ) ;
You can’t perform that action at this time.
0 commit comments