public void TestHashCodeAndEquals() { var k1 = new ValueKey("A", 5); var k2 = new ValueKey("A", 5); Assert.Equal(k1.GetHashCode(), k2.GetHashCode()); Assert.True(k1.Equals(k2)); var k3 = new ValueKey("row_1", "col_1"); var k4 = new ValueKey("row_1", "col_1"); Assert.Equal(k3.GetHashCode(), k4.GetHashCode()); Assert.NotEqual(k1.GetHashCode(), k3.GetHashCode()); Assert.True(k3.Equals(k4)); Assert.False(k4.Equals(k2)); var k5 = new ValueKey("row_2", "col_1"); Assert.NotEqual(k4.GetHashCode(), k5.GetHashCode()); Assert.False(k5.Equals(k3)); Assert.False(k5.Equals(null)); Assert.True(Key.IsEmpty(Key.Empty)); Assert.False(Key.IsEmpty(1)); Assert.False(Key.IsEmpty(null)); Assert.True(Key.Equals("A", "A")); Assert.False(Key.Equals("A", "B")); Assert.False(Key.Equals("A", null)); Assert.False(Key.Equals(null, "A")); Assert.True(Key.Equals(null, null)); }