public void GetHashCodeTest() { var r = new Register8(10); Assert.Equal(r.GetHashCode(), new Register8(10).GetHashCode()); Assert.NotEqual(r.GetHashCode(), new Register8(20).GetHashCode()); }
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()); }