예제 #1
0
        public void EqualityTest_NotRegister8()
        {
            var r = new Register8(0);

            Assert.False(r.Equals(null));
            Assert.False(r.Equals(0));
        }
예제 #2
0
        public void EqualityTest(byte value)
        {
            var r1 = new Register8(value);
            var r2 = new Register8((byte)(value / 2 - 1));
            var r3 = new Register8(value);

            Assert.True(r1 == r3);
            Assert.True(r1 != r2);
            Assert.True(r2 != r3);

            Assert.True(r1.Equals(r3));
            Assert.False(r1.Equals(r2));
            Assert.False(r2.Equals(r3));

            Assert.True(r1.Equals((object)r3));
            Assert.False(r1.Equals((object)r2));
            Assert.False(r2.Equals((object)r3));

            Assert.Equal(r1.GetHashCode(), r3.GetHashCode());
        }