-
Notifications
You must be signed in to change notification settings - Fork 256
Expand file tree
/
Copy pathIncludeStringEvaluatorTests.cs
More file actions
60 lines (47 loc) · 1.56 KB
/
IncludeStringEvaluatorTests.cs
File metadata and controls
60 lines (47 loc) · 1.56 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
namespace Tests.Evaluators;
[Collection("SharedCollection")]
public class IncludeStringEvaluatorTests(TestFactory factory) : IntegrationTest(factory)
{
private static readonly IncludeStringEvaluator _evaluator = IncludeStringEvaluator.Instance;
[Fact]
public void QueriesMatch_GivenNoIncludeString()
{
var spec = new Specification<Store>();
var actual = _evaluator
.GetQuery(DbContext.Stores, spec)
.ToQueryString();
var expected = DbContext.Stores
.ToQueryString();
actual.Should().Be(expected);
}
[Fact]
public void QueriesMatch_GivenIncludeString()
{
var spec = new Specification<Store>();
spec.Query
.Include(nameof(Address));
var actual = _evaluator
.GetQuery(DbContext.Stores, spec)
.ToQueryString();
var expected = DbContext.Stores
.Include(nameof(Address))
.ToQueryString();
actual.Should().Be(expected);
}
[Fact]
public void QueriesMatch_GivenMultipleIncludeStrings()
{
var spec = new Specification<Store>();
spec.Query
.Include(nameof(Address))
.Include($"{nameof(Company)}.{nameof(Country)}");
var actual = _evaluator
.GetQuery(DbContext.Stores, spec)
.ToQueryString();
var expected = DbContext.Stores
.Include(nameof(Address))
.Include($"{nameof(Company)}.{nameof(Country)}")
.ToQueryString();
actual.Should().Be(expected);
}
}