-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTeamCityPropertiesTests.cs
55 lines (43 loc) · 1.27 KB
/
TeamCityPropertiesTests.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
namespace CSharpInteractive.Tests;
using JetBrains.TeamCity.ServiceMessages.Write.Special;
public class TeamCityPropertiesTests
{
private readonly Mock<IProperties> _properties = new();
private readonly Mock<ITeamCityWriter> _teamCityWriter = new();
[Fact]
public void ShouldSetProperty()
{
// Given
var props = CreateInstance();
// When
props["Abc"] = "Xyz";
// Then
_properties.VerifySet(i => i["Abc"] = "Xyz");
_teamCityWriter.Verify(i => i.WriteBuildParameter("system.Abc", "Xyz"));
}
[Fact]
public void ShouldGetProperty()
{
// Given
var props = CreateInstance();
var curVal = "Xyz";
_properties.Setup(i => i.TryGetValue("Abc", out curVal)).Returns(true);
// When
props.TryGetValue("Abc", out var actual).ShouldBeTrue();
// Then
actual.ShouldBe("Xyz");
}
[Fact]
public void ShouldProvideCount()
{
// Given
var props = CreateInstance();
_properties.SetupGet(i => i.Count).Returns(2);
// When
var actual = props.Count;
// Then
actual.ShouldBe(2);
}
private TeamCityProperties CreateInstance() =>
new(_properties.Object, _teamCityWriter.Object);
}