Example #1
0
        public void ShouldPassEqualsTest()
        {
            var value            = SameValue();
            var primitive        = CreatePrimitive(value);
            var samePrimitive    = CreatePrimitive(value);
            var anotherPrimitive = new GenericPrimitive <TValue>(value);

            Assert.False(primitive.Equals((object)null));
            Assert.True(primitive.Equals((object)primitive));
            Assert.False(primitive.Equals((object)anotherPrimitive));
            Assert.True(primitive.Equals((object)samePrimitive));
            Assert.False(primitive.Equals((object)CreatePrimitive(AnotherValue())));
        }
Example #2
0
        public void ShouldPassGenericEqualsTest()
        {
            var value            = SameValue();
            var primitive        = CreatePrimitive(value);
            var samePrimitive    = CreatePrimitive(value);
            var anotherPrimitive = new GenericPrimitive <TValue>(value);

            GenericPrimitive <TValue> nullPrimitive = null;

            Assert.False(primitive.Equals(nullPrimitive));
            Assert.True(primitive.Equals(primitive));
            Assert.False(primitive.Equals(anotherPrimitive));
            Assert.True(primitive.Equals(samePrimitive));
            Assert.False(primitive.Equals(CreatePrimitive(AnotherValue())));
        }