-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTeamCityInOutTests.cs
47 lines (37 loc) · 1.17 KB
/
TeamCityInOutTests.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
namespace CSharpInteractive.Tests;
using JetBrains.TeamCity.ServiceMessages.Write.Special;
public class TeamCityInOutTests
{
private readonly Mock<ITeamCityLineFormatter> _lineFormatter;
private readonly Mock<ITeamCityWriter> _teamCityWriter;
public TeamCityInOutTests()
{
_lineFormatter = new Mock<ITeamCityLineFormatter>();
_lineFormatter.Setup(i => i.Format(It.IsAny<Text[]>())).Returns<Text[]>(i => "F_" + i.ToSimpleString());
_teamCityWriter = new Mock<ITeamCityWriter>();
}
[Fact]
public void ShouldWriteError()
{
// Given
IStdErr output = CreateInstance();
// When
output.WriteLine([new Text("err")]);
// Then
_teamCityWriter.Verify(i => i.WriteError("F_err", null));
}
[Fact]
public void ShouldWriteMessage()
{
// Given
IStdOut output = CreateInstance();
// When
output.WriteLine([new Text("message")]);
// Then
_teamCityWriter.Verify(i => i.WriteMessage("F_message"));
}
private TeamCityInOut CreateInstance() =>
new(
_lineFormatter.Object,
_teamCityWriter.Object);
}