/
TupleFixture.cs
54 lines (43 loc) · 1.3 KB
/
TupleFixture.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
using LibGit2Sharp.Core.Compat;
using Xunit;
namespace LibGit2Sharp.Tests
{
public class TupleFixture
{
const int integer = 2;
const string stringy = "hello";
private readonly Tuple<int, string> sut = new Tuple<int, string>(integer, stringy);
[Fact]
public void Properties()
{
Assert.Equal(integer, sut.Item1);
Assert.Equal(stringy, sut.Item2);
}
[Fact]
public void GetHashCodeIsTheSame()
{
var sut2 = new Tuple<int, string>(integer, stringy);
Assert.Equal(sut2.GetHashCode(), sut.GetHashCode());
}
[Fact]
public void GetHashCodeIsDifferent()
{
var sut2 = new Tuple<int, string>(integer + 1, stringy);
Assert.NotEqual(sut2.GetHashCode(), sut.GetHashCode());
}
[Fact]
public void VerifyEquals()
{
var sut2 = new Tuple<int, string>(integer, stringy);
Assert.True(sut.Equals(sut2));
Assert.True(Equals(sut, sut2));
}
[Fact]
public void VerifyNotEquals()
{
var sut2 = new Tuple<int, string>(integer + 1, stringy);
Assert.False(sut.Equals(sut2));
Assert.False(Equals(sut, sut2));
}
}
}