-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathMongoSourceSettingsTests.cs
More file actions
109 lines (87 loc) · 2.59 KB
/
MongoSourceSettingsTests.cs
File metadata and controls
109 lines (87 loc) · 2.59 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using Cosmos.DataTransfer.MongoExtension.Settings;
namespace Cosmos.DataTransfer.MongoExtension.UnitTests;
[TestClass]
public class MongoSourceSettingsTests
{
[TestMethod]
public void MongoSourceSettings_ShouldHaveQueryProperty()
{
// Arrange & Act
var settings = new MongoSourceSettings();
// Assert
Assert.IsNull(settings.Query);
}
[TestMethod]
public void MongoSourceSettings_ShouldAllowQueryToBeSet()
{
// Arrange
var settings = new MongoSourceSettings();
var testQuery = """{"status": "active"}""";
// Act
settings.Query = testQuery;
// Assert
Assert.AreEqual(testQuery, settings.Query);
}
[TestMethod]
public void MongoSourceSettings_ShouldAllowNullQuery()
{
// Arrange
var settings = new MongoSourceSettings();
// Act
settings.Query = null;
// Assert
Assert.IsNull(settings.Query);
}
[TestMethod]
public void MongoSourceSettings_ShouldAllowEmptyQuery()
{
// Arrange
var settings = new MongoSourceSettings();
// Act
settings.Query = string.Empty;
// Assert
Assert.AreEqual(string.Empty, settings.Query);
}
[TestMethod]
public void MongoSourceSettings_ShouldHaveBatchSizeProperty()
{
// Arrange & Act
var settings = new MongoSourceSettings();
// Assert
Assert.IsNull(settings.BatchSize);
}
[TestMethod]
public void MongoSourceSettings_ShouldAllowBatchSizeToBeSet()
{
// Arrange
var settings = new MongoSourceSettings();
var testBatchSize = 1000;
// Act
settings.BatchSize = testBatchSize;
// Assert
Assert.AreEqual(testBatchSize, settings.BatchSize);
}
[TestMethod]
public void MongoSourceSettings_ShouldAllowNullBatchSize()
{
// Arrange
var settings = new MongoSourceSettings();
// Act
settings.BatchSize = null;
// Assert
Assert.IsNull(settings.BatchSize);
}
[TestMethod]
public void MongoSourceSettings_ShouldAcceptPositiveBatchSize()
{
// Arrange
var settings = new MongoSourceSettings();
var positiveBatchSizes = new[] { 1, 100, 1000, 10000 };
// Act & Assert
foreach (var batchSize in positiveBatchSizes)
{
settings.BatchSize = batchSize;
Assert.AreEqual(batchSize, settings.BatchSize);
}
}
}