1- using System ;
2- using System . Collections . Generic ;
3- using System . Linq ;
4- using System . Text ;
5-
6- namespace Simple . Data . IntegrationTest . Query
7- {
8- using Mocking . Ado ;
9- using NUnit . Framework ;
10-
11- [ TestFixture ]
12- public class WithCountTest : DatabaseIntegrationContext
13- {
14- protected override void SetSchema ( MockSchemaProvider schemaProvider )
15- {
16- schemaProvider . SetTables ( new [ ] { "dbo" , "Users" , "BASE TABLE" } ) ;
17-
18- schemaProvider . SetColumns ( new [ ] { "dbo" , "Users" , "Name" } ,
19- new [ ] { "dbo" , "Users" , "Password" } ) ;
20- }
21-
22- [ Test ]
23- public void WithTotalCountShouldCreateCompoundQuery_ObsoleteFutureVersion ( )
24- {
25- const string expected = @"select count(*) from [dbo].[users] where [dbo].[users].[name] = @p1_c0; " +
26- @"select [dbo].[users].[name],[dbo].[users].[password] from [dbo].[users] where [dbo].[users].[name] = @p1_c1" ;
27-
28- Future < int > count ;
29- var q = _db . Users . QueryByName ( "Foo" )
30- . WithTotalCount ( out count ) ;
31-
32- EatException < InvalidOperationException > ( ( ) => q . ToList ( ) ) ;
33-
34- GeneratedSqlIs ( expected ) ;
35- }
36-
37- [ Test ]
38- public void WithTotalCountShouldCreateCompoundQuery ( )
39- {
40- const string expected = @"select count(*) from [dbo].[users] where [dbo].[users].[name] = @p1_c0; " +
41- @"select [dbo].[users].[name],[dbo].[users].[password] from [dbo].[users] where [dbo].[users].[name] = @p1_c1" ;
42-
43- Promise < int > count ;
44- var q = _db . Users . QueryByName ( "Foo" )
45- . WithTotalCount ( out count ) ;
46-
47- EatException < InvalidOperationException > ( ( ) => q . ToList ( ) ) ;
48-
49- GeneratedSqlIs ( expected ) ;
1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using Simple . Data . Ado ;
6+ using Simple . Data . Mocking ;
7+
8+ namespace Simple . Data . IntegrationTest . Query
9+ {
10+ using Mocking . Ado ;
11+ using NUnit . Framework ;
12+
13+ [ TestFixture ]
14+ public class WithCountTest : DatabaseIntegrationContext
15+ {
16+ protected override void SetSchema ( MockSchemaProvider schemaProvider )
17+ {
18+ schemaProvider . SetTables ( new [ ] { "dbo" , "Users" , "BASE TABLE" } ) ;
19+
20+ schemaProvider . SetColumns ( new [ ] { "dbo" , "Users" , "Name" } ,
21+ new [ ] { "dbo" , "Users" , "Password" } ) ;
22+ }
23+
24+ [ Test ]
25+ // ReSharper disable InconsistentNaming
26+ public void WithTotalCountShouldCreateCompoundQuery_ObsoleteFutureVersion ( )
27+ // ReSharper restore InconsistentNaming
28+ {
29+ const string expected = @"select count(*) from [dbo].[users] where [dbo].[users].[name] = @p1_c0; " +
30+ @"select [dbo].[users].[name],[dbo].[users].[password] from [dbo].[users] where [dbo].[users].[name] = @p1_c1" ;
31+
32+ Future < int > count ;
33+ var q = _db . Users . QueryByName ( "Foo" )
34+ . WithTotalCount ( out count ) ;
35+
36+ EatException < InvalidOperationException > ( ( ) => q . ToList ( ) ) ;
37+
38+ GeneratedSqlIs ( expected ) ;
39+ }
40+
41+ [ Test ]
42+ public void WithTotalCountShouldCreateCompoundQuery ( )
43+ {
44+ const string expected = @"select count(*) from [dbo].[users] where [dbo].[users].[name] = @p1_c0; " +
45+ @"select [dbo].[users].[name],[dbo].[users].[password] from [dbo].[users] where [dbo].[users].[name] = @p1_c1" ;
46+
47+ Promise < int > count ;
48+ var q = _db . Users . QueryByName ( "Foo" )
49+ . WithTotalCount ( out count ) ;
50+
51+ EatException < InvalidOperationException > ( ( ) => q . ToList ( ) ) ;
52+
53+ GeneratedSqlIs ( expected ) ;
5054 }
5155
5256 [ Test ]
@@ -64,5 +68,5 @@ public void WithTotalCountWithExplicitSelectShouldCreateCompoundQuery()
6468
6569 GeneratedSqlIs ( expected ) ;
6670 }
67- }
68- }
71+ }
72+ }
0 commit comments