public void GetHashCodeIsTheSame() { var sut2 = new Tuple<int, string>(integer, stringy); Assert.Equal(sut2.GetHashCode(), sut.GetHashCode()); }
public void Value_type_tuple() { // This is a bit contrived, just need an easy class (ie non-value type) var helper = new IdHelperForClassType<Tuple<int, int>>(); var tuple1 = new Tuple<int, int>(1, 2); var tuple2 = new Tuple<int, int>(1, 3); var tuple1Again = new Tuple<int, int>(1, 2); Assert.AreEqual(true, helper.IsNull(null)); Assert.AreEqual(true, helper.IsDefaultValue(null)); Assert.AreEqual(false, helper.IsDefaultValue(tuple1)); Assert.AreEqual(true, helper.AreEqual(null, null)); Assert.AreEqual(true, helper.AreEqual(tuple1, tuple1Again)); Assert.AreEqual(-1, helper.Compare(null, tuple1)); Assert.AreEqual(-1, helper.Compare(tuple1, tuple2)); Assert.AreEqual(+1, helper.Compare(tuple2, null)); Assert.AreEqual(+1, helper.Compare(tuple2, tuple1)); Assert.That(helper.Compare(null, null), Is.EqualTo(0)); Assert.AreEqual(0, helper.Compare(tuple1, tuple1Again)); Assert.AreEqual(tuple1.GetHashCode(), helper.GetHashCode(tuple1)); Assert.AreEqual(0, helper.GetHashCode(null)); }
public void CanHashCodeTwoFiveSizedNullableTuples() { var tuple1 = new Tuple<int?>(1, 2, null, 4, 5); var tuple2 = new Tuple<int?>(1, 2, null, 4, 5); var tuple3 = new Tuple<int?>(1, 2, 3, 4, null); tuple2.GetHashCode().Should().Be(tuple1.GetHashCode()); tuple3.GetHashCode().Should().Not.Be(tuple1.GetHashCode()); }
public void GetHashCodeIsDifferent() { var sut2 = new Tuple<int, string>(integer + 1, stringy); Assert.NotEqual(sut2.GetHashCode(), sut.GetHashCode()); }
public void CannotHashCodeTwoDifferentSizesTuples() { var tuple1 = new Tuple<int>(1, 2, 3, 4, 5); var tuple2 = new Tuple<int>(1, 2, 3, 4, 5, 6); tuple2.GetHashCode().Should().Not.Be(tuple1.GetHashCode()); }
public void CanHashCodeTwoFiveSizedTuples() { var tuple1 = new Tuple<int>(1, 2, 3, 4, 5); var tuple2 = new Tuple<int>(1, 2, 3, 4, 5); var tuple3 = new Tuple<int>(1, 2, 3, 4, 6); tuple2.GetHashCode().Should().Be(tuple1.GetHashCode()); tuple3.GetHashCode().Should().Not.Be(tuple1.GetHashCode()); }
public void GetHashCodeIsTheSame() { var sut2 = new Tuple<int, string>(integer, stringy); sut.GetHashCode().ShouldEqual(sut2.GetHashCode()); }
public static int GetHashCode(Tuple<string, string> fromStatusSubStatus, Tuple<string, string> toStatusSubStatus) { return (fromStatusSubStatus.GetHashCode() << 8) + toStatusSubStatus.GetHashCode(); }
public override int GetHashCode() { var tuple = new Tuple<string, string> (Id, Destination); return tuple.GetHashCode (); }