This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
tests/ServiceStack.OrmLite.Tests Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,31 @@ namespace ServiceStack.OrmLite.Tests
1010 public class CaptureSqlFilterTests
1111 : OrmLiteTestBase
1212 {
13+ [ Test ]
14+ public void Can_capture_each_type_of_API ( )
15+ {
16+ using ( var captured = new CaptureSqlFilter ( ) )
17+ using ( var db = OpenDbConnection ( ) )
18+ {
19+ db . CreateTable < Person > ( ) ;
20+ db . Select < Person > ( x => x . Age > 40 ) ;
21+ db . Single < Person > ( x => x . Age == 42 ) ;
22+ db . Count < Person > ( x => x . Age < 50 ) ;
23+ db . Insert ( new Person { Id = 7 , FirstName = "Amy" , LastName = "Winehouse" } ) ;
24+ db . Update ( new Person { Id = 1 , FirstName = "Jimi" , LastName = "Hendrix" } ) ;
25+ db . Delete < Person > ( new { FirstName = "Jimi" , Age = 27 } ) ;
26+ db . SqlColumn < string > ( "SELECT LastName FROM Person WHERE Age < @age" ,
27+ new { age = 50 } ) ;
28+ db . SqlList < Person > ( "exec sp_name @firstName, @age" ,
29+ new { firstName = "aName" , age = 1 } ) ;
30+ db . ExecuteNonQuery ( "UPDATE Person SET LastName={0} WHERE Id={1}"
31+ . SqlFmt ( "WaterHouse" , 7 ) ) ;
32+
33+ var sql = string . Join ( ";\n \n " , captured . SqlStatements . ToArray ( ) ) ;
34+ sql . Print ( ) ;
35+ }
36+ }
37+
1338 [ Test ]
1439 public void Can_capture_CreateTable_APIs ( )
1540 {
You can’t perform that action at this time.
0 commit comments