Esempio n. 1
0
        public void EqualityTests()
        {
            Rect2 rect1 = new Rect2(10, 20, 50, 30);
            Rect2 rect2 = new Rect2(10, 20, 50, 30);
            Rect2 rect3 = new Rect2(2, 2, 2, 2);

            object value = 123;

            Assert.True(rect1.Equals(rect2));
            Assert.True(rect1.Equals((object)rect2));
            Assert.True(rect1 == rect2);
            Assert.True(rect1 != rect3);
            Assert.Equal(rect1.GetHashCode(), rect2.GetHashCode());

            Assert.False(rect1.Equals(rect3));
            Assert.False(rect1.Equals(value));
            Assert.False(rect1 == rect3);
            Assert.False(rect1 != rect2);
            Assert.NotEqual(rect1.GetHashCode(), rect3.GetHashCode());
        }