-
-
Notifications
You must be signed in to change notification settings - Fork 722
/
DataLoaderOptionsTests.cs
81 lines (71 loc) · 2.09 KB
/
DataLoaderOptionsTests.cs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using Snapshooter.Xunit;
using Xunit;
namespace GreenDonut;
public class DataLoaderOptionsTests
{
[Fact(DisplayName = "Constructor: Should set all properties 1")]
public void ConstructorAllProps1()
{
// act
var options = new DataLoaderOptions
{
Cache = new TaskCache(1),
Caching = true,
MaxBatchSize = 1,
DiagnosticEvents = new DataLoaderDiagnosticEventListener()
};
// assert
Assert.NotNull(options.Cache);
Assert.True(options.Caching);
Assert.Equal(1, options.MaxBatchSize);
Assert.NotNull(options.DiagnosticEvents);
}
[Fact(DisplayName = "Constructor: Should set all properties 2")]
public void ConstructorAllProps2()
{
// act
var options = new DataLoaderOptions
{
Cache = null,
Caching = false,
MaxBatchSize = 10,
DiagnosticEvents = null
};
// assert
Assert.Null(options.Cache);
Assert.False(options.Caching);
Assert.Equal(10, options.MaxBatchSize);
Assert.Null(options.DiagnosticEvents);
}
[Fact(DisplayName = "Constructor: Should result in defaults")]
public void ConstructorEmpty()
{
// act
var options = new DataLoaderOptions();
// assert
Assert.Null(options.Cache);
Assert.True(options.Caching);
Assert.Equal(1024, options.MaxBatchSize);
Assert.Null(options.DiagnosticEvents);
}
[Fact(DisplayName = "Copy: Should copy all property values")]
public void Copy()
{
// arrange
var options = new DataLoaderOptions
{
Cache = new TaskCache(1),
Caching = true,
MaxBatchSize = 1,
DiagnosticEvents = new DataLoaderDiagnosticEventListener()
};
// act
var copy = options.Copy();
// assert
Assert.NotNull(copy.Cache);
Assert.True(copy.Caching);
Assert.Equal(1, copy.MaxBatchSize);
Assert.NotNull(copy.DiagnosticEvents);
}
}