示例#1
0
        public void EqualityTest_NotRegister16()
        {
            var r = new Register16(0);

            Assert.False(r.Equals(null));
            Assert.False(r.Equals(0));
        }
示例#2
0
        public void EqualityTest(ushort value)
        {
            var r1 = new Register16(value);
            var r2 = new Register16((ushort)(value / 2 - 1));
            var r3 = new Register16(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());
        }