From 1032a147f341c600a23adbdb493dcb603ad3473e Mon Sep 17 00:00:00 2001 From: nulltoken Date: Sun, 6 Nov 2011 14:01:28 +0100 Subject: Add basic Tuple type --- LibGit2Sharp.Tests/TupleFixture.cs | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 LibGit2Sharp.Tests/TupleFixture.cs (limited to 'LibGit2Sharp.Tests/TupleFixture.cs') 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 sut = new Tuple(integer, stringy); + + [Test] + public void Properties() + { + sut.Item1.ShouldEqual(integer); + sut.Item2.ShouldEqual(stringy); + } + + [Test] + public void GetHashCodeIsTheSame() + { + var sut2 = new Tuple(integer, stringy); + + sut.GetHashCode().ShouldEqual(sut2.GetHashCode()); + } + + [Test] + public void GetHashCodeIsDifferent() + { + var sut2 = new Tuple(integer + 1, stringy); + + sut.GetHashCode().ShouldNotEqual(sut2.GetHashCode()); + } + + [Test] + public void Equals() + { + var sut2 = new Tuple(integer, stringy); + + sut.Equals(sut2).ShouldBeTrue(); + Equals(sut, sut2).ShouldBeTrue(); + } + + [Test] + public void NotEquals() + { + var sut2 = new Tuple(integer + 1, stringy); + + sut.Equals(sut2).ShouldBeFalse(); + Equals(sut, sut2).ShouldBeFalse(); + } + } +} -- cgit v1.2.3