Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TupleFixture.cs « LibGit2Sharp.Tests - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f909bcd0d1f41fafd81a4e54a01e5799936d4f9c (plain)
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
using LibGit2Sharp.Core.Compat;
using LibGit2Sharp.Tests.TestHelpers;
using NUnit.Framework;

namespace LibGit2Sharp.Tests
{
    [TestFixture]
    public class TupleFixture
    {
        const int integer = 2;
        const string stringy = "hello";

        private readonly Tuple<int, string> sut = new Tuple<int, string>(integer, stringy);

        [Test]
        public void Properties()
        {
            sut.Item1.ShouldEqual(integer);
            sut.Item2.ShouldEqual(stringy);
        }

        [Test]
        public void GetHashCodeIsTheSame()
        {
            var sut2 = new Tuple<int, string>(integer, stringy);

            sut.GetHashCode().ShouldEqual(sut2.GetHashCode());
        }

        [Test]
        public void GetHashCodeIsDifferent()
        {
            var sut2 = new Tuple<int, string>(integer + 1, stringy);

            sut.GetHashCode().ShouldNotEqual(sut2.GetHashCode());
        }

        [Test]
        public void Equals()
        {
            var sut2 = new Tuple<int, string>(integer, stringy);

            sut.Equals(sut2).ShouldBeTrue();
            Equals(sut, sut2).ShouldBeTrue();
        }

        [Test]
        public void NotEquals()
        {
            var sut2 = new Tuple<int, string>(integer + 1, stringy);

            sut.Equals(sut2).ShouldBeFalse();
            Equals(sut, sut2).ShouldBeFalse();
        }
    }
}