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 | |
parent | d526b188d7b18b5d4ed8da4c3e1fb3a1b954e470 (diff) |
Add basic Tuple<T1, T2> type
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/LazyFixture.cs | 2 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 1 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/TupleFixture.cs | 56 |
3 files changed, 58 insertions, 1 deletions
diff --git a/LibGit2Sharp.Tests/LazyFixture.cs b/LibGit2Sharp.Tests/LazyFixture.cs index 84862a12..f878b88b 100644 --- a/LibGit2Sharp.Tests/LazyFixture.cs +++ b/LibGit2Sharp.Tests/LazyFixture.cs @@ -1,5 +1,5 @@ using System; -using LibGit2Sharp.Core; +using LibGit2Sharp.Core.Compat; using LibGit2Sharp.Tests.TestHelpers; using NUnit.Framework; diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index df538a91..eaba5a8e 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -64,6 +64,7 @@ <Compile Include="TestHelpers\SignatureExtensions.cs" /> <Compile Include="TestHelpers\TemporaryCloneOfTestRepo.cs" /> <Compile Include="TreeFixture.cs" /> + <Compile Include="TupleFixture.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\LibGit2Sharp\LibGit2Sharp.csproj"> 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(); + } + } +} |