forked from mmanela/chutzpah
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CoverageFileDataFacts.cs
68 lines (55 loc) · 1.69 KB
/
CoverageFileDataFacts.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
66
67
68
using System.Linq;
using Chutzpah.Models;
using Xunit;
namespace Chutzpah.Facts.Integration
{
public class CoverageFileDataFacts
{
private CoverageFileData data1;
private CoverageFileData data2;
public CoverageFileDataFacts()
{
this.data1 = new CoverageFileData
{
FilePath = "test1",
LineExecutionCounts = new int?[] { null, 1, 0, 1 },
SourceLines = new[] { "" }
};
this.data2 = new CoverageFileData
{
FilePath = "test1",
LineExecutionCounts = new int?[] { null, 0, 1, 0 },
SourceLines = new[] { "" }
};
}
[Fact]
public void Will_CoveragePercentage_calculated_right_for_Data1()
{
// Arrange
// Act
var percentage = this.data1.CoveragePercentage;
// Assert
Assert.Equal(0.67, percentage, 2);
}
[Fact]
public void Will_CoveragePercentage_calculated_right_for_Data2()
{
// Arrange
// Act
var percentage = this.data2.CoveragePercentage;
// Assert
Assert.Equal(0.33, percentage, 2);
}
[Fact]
public void If_call_CoveragePercentage_before_merge_Data1_and_Data2_and_after_merge_CoveragePercentage_changing()
{
// Arrange
var fakePercentage = this.data1.CoveragePercentage;
this.data1.Merge(this.data2);
// Act
var percentage = this.data1.CoveragePercentage;
// Assert
Assert.Equal(1, percentage, 2);
}
}
}