-
-
Notifications
You must be signed in to change notification settings - Fork 524
Expand file tree
/
Copy pathFirebirdLimitTests.cs
More file actions
55 lines (45 loc) · 1.46 KB
/
FirebirdLimitTests.cs
File metadata and controls
55 lines (45 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using SqlKata.Compilers;
using SqlKata.Tests.Infrastructure;
using Xunit;
namespace SqlKata.Tests.Firebird
{
public class FirebirdLimitTests : TestSupport
{
private readonly FirebirdCompiler compiler;
public FirebirdLimitTests()
{
compiler = Compilers.Get<FirebirdCompiler>(EngineCodes.Firebird);
}
[Fact]
public void NoLimitNorOffset()
{
var query = new Query("Table");
var ctx = new SqlResult(compiler) { Query = query };
Assert.Null(compiler.CompileLimit(ctx));
}
[Fact]
public void LimitOnly()
{
var query = new Query("Table").Limit(10);
var ctx = new SqlResult(compiler) { Query = query };
Assert.Null(compiler.CompileLimit(ctx));
}
[Fact]
public void OffsetOnly()
{
var query = new Query("Table").Offset(20);
var ctx = new SqlResult(compiler) { Query = query };
Assert.Null(compiler.CompileLimit(ctx));
}
[Fact]
public void LimitAndOffset()
{
var query = new Query("Table").Limit(5).Offset(20);
var ctx = new SqlResult(compiler) { Query = query };
Assert.Equal("ROWS ? TO ?", compiler.CompileLimit(ctx));
Assert.Equal(21L, ctx.Bindings[0]);
Assert.Equal(25L, ctx.Bindings[1]);
Assert.Equal(2, ctx.Bindings.Count);
}
}
}