-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.GetSqlQuery.cs
More file actions
68 lines (65 loc) · 1.79 KB
/
Test.GetSqlQuery.cs
File metadata and controls
68 lines (65 loc) · 1.79 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
56
57
58
59
60
61
62
63
64
65
66
67
68
using Xunit;
namespace GarageGroup.Infra.Sql.Api.Core.Test;
partial class DbQueryTest
{
[Theory]
[MemberData(nameof(SqlQueryTestData))]
public static void GetFilterSqlQuery_TypesAreInRange_ExpectCorrectSqlQuery(
DbQuery source, SqlDialect dialect, string expected)
{
var actual = source.GetSqlQuery(dialect);
Assert.Equal(expected, actual);
}
public static TheoryData<DbQuery, SqlDialect, string> SqlQueryTestData
=>
new()
{
{
new(null!),
SqlDialect.TransactSql,
string.Empty
},
{
new(string.Empty),
SqlDialect.PostgreSql,
string.Empty
},
{
new("Some SQL Query"),
SqlDialect.TransactSql,
"Some SQL Query"
},
{
new(
query: null!,
parameters:
[
new("P1", 15),
new("P2", "Some text")
]),
SqlDialect.TransactSql,
string.Empty
},
{
new(
query: string.Empty,
parameters:
[
new("SomeName", null)
]),
(SqlDialect)37,
string.Empty
},
{
new(
query: "Some query",
parameters:
[
new("SomeName1", "One"),
new("SomeName2", null)
]),
SqlDialect.PostgreSql,
"Some query"
}
};
}