diff options
author | nulltoken <emeric.fermas@gmail.com> | 2011-11-06 17:01:28 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2011-11-28 18:36:31 +0400 |
commit | 1032a147f341c600a23adbdb493dcb603ad3473e (patch) | |
tree | d8ea7e92bf4665bafc73984a24acdbf759468b59 /LibGit2Sharp.Tests/TupleFixture.cs | |
parent | d526b188d7b18b5d4ed8da4c3e1fb3a1b954e470 (diff) |
Add basic Tuple<T1, T2> type
Diffstat (limited to 'LibGit2Sharp.Tests/TupleFixture.cs')
-rw-r--r-- | LibGit2Sharp.Tests/TupleFixture.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/TupleFixture.cs b/LibGit2Sharp.Tests/TupleFixture.cs new file mode 100644 index 00000000..f909bcd0 --- /dev/null +++ b/LibGit2Sharp.Tests/TupleFixture.cs @@ -0,0 +1,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(); + } + } +} |