-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatisticsTests.cs
39 lines (33 loc) · 1.04 KB
/
StatisticsTests.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
namespace CSharpInteractive.Tests;
public class StatisticsTests
{
[Fact]
public void ShouldTrackTimeElapsed()
{
// Given
var statistics = new Statistics();
// When
using (statistics.Start())
{
Thread.Sleep(2);
}
// Then
statistics.TimeElapsed.ShouldNotBe(TimeSpan.Zero);
}
[Theory]
[InlineData(StatisticsType.Error)]
[InlineData(StatisticsType.Warning)]
[InlineData(StatisticsType.Summary)]
internal void ShouldRegisterError(StatisticsType statisticsType)
{
// Given
var statistics = new Statistics();
// When
statistics.Register(statisticsType, new Text("Abc"));
statistics.Register(statisticsType, Text.Empty);
statistics.Register(statisticsType, new Text(" "));
statistics.Register(statisticsType, new Text("Xyz"));
// Then
statistics.Items.ShouldBe([new StatisticsItem(statisticsType, new Text("Abc")), new StatisticsItem(statisticsType, new Text("Xyz"))]);
}
}