-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlowIdGeneratorTests.cs
65 lines (51 loc) · 1.44 KB
/
FlowIdGeneratorTests.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
namespace CSharpInteractive.Tests;
public class FlowIdGeneratorTests
{
private readonly Mock<ICISettings> _teamCitySettings = new();
[Fact]
public void ShouldProvideRootFlowIdWhenItIsSpecified()
{
// Given
_teamCitySettings.SetupGet(i => i.FlowId).Returns("root");
var generator = CreateInstance();
// When
var flowId = generator.NewFlowId();
// Then
flowId.ShouldBe("root");
}
[Fact]
public void ShouldProvideNexFlowIdAfterRootFlowIdWhenItIsSpecified()
{
// Given
var generator = CreateInstance();
_teamCitySettings.SetupGet(i => i.FlowId).Returns("root");
// When
generator.NewFlowId();
var flowId = generator.NewFlowId();
// Then
flowId.ShouldNotBe("root");
}
[Fact]
public void ShouldProvideFlowIdWhenRootFlowIdIsNotSpecified()
{
// Given
var generator = CreateInstance();
// When
var flowId = generator.NewFlowId();
// Then
flowId.ShouldNotBe("root");
}
[Fact]
public void ShouldProvideGenerateFlowIds()
{
// Given
var generator = CreateInstance();
// When
var flowId1 = generator.NewFlowId();
var flowId2 = generator.NewFlowId();
// Then
flowId1.ShouldNotBe(flowId2);
}
private FlowIdGenerator CreateInstance() =>
new(_teamCitySettings.Object);
}