Пример #1
0
        public void IdenticalValuesAreEqual()
        {
            var a = new SampleValueObject {
                ShortValue = 2000, StringValue = "A", Value = -1
            };
            var b = new SampleValueObject {
                ShortValue = 2000, StringValue = "A", Value = -1
            };

            PAssert.That(() =>
                         a.Equals(b) &&
                         a == b &&
                         a.GetHashCode() == b.GetHashCode() &&
                         !ReferenceEquals(a, b)
                         );
        }
Пример #2
0
        public void DifferentValuesAreUnequal()
        {
            var a = new SampleValueObject {
                ShortValue = 2000, StringValue = "A", Value = -1
            };
            var b = new SampleValueObject {
                ShortValue = 2000, StringValue = "a", Value = -1
            };

            PAssert.That(() =>
                         !a.Equals(b) &&
                         a != b &&
                         a.GetHashCode() != b.GetHashCode() &&
                         !ReferenceEquals(a, b)
                         );
        }