예제 #1
0
        public void CanHashCodeTwoNullableDifferentTypeTriplets()
        {
            var triplet1 = new Triplet<string, int?, Type>("1", 2, typeof(Console));
            var triplet2 = new Triplet<string, int?, Type>("1", 2, typeof(Console));
            var triplet3 = new Triplet<string, int?, Type>("1", null, typeof(Console));

            triplet2.GetHashCode().Should().Be(triplet1.GetHashCode());
            triplet3.GetHashCode().Should().Not.Be(triplet1.GetHashCode());
        }
예제 #2
0
        public void CanHashCodeTwoNullableTriplets()
        {
            var pair1 = new Triplet<int?>(1, null, 42);
            var pair2 = new Triplet<int?>(1, null, 42);
            var pair3 = new Triplet<int?>(null, 2, null);

            pair2.GetHashCode().Should().Be(pair1.GetHashCode());
            pair3.GetHashCode().Should().Not.Be(pair1.GetHashCode());
        }
예제 #3
0
 public override int GetHashCode()
 {
     return(triplet.GetHashCode());
 }