public void TestHashCodeDontChangeOnInstance() { var v = new Tile.Value(); v.StringValue = "Hello"; int hashCode = v.GetHashCode(); // Test value change v.StringValue = "World"; Assert.Equal(hashCode, v.GetHashCode()); // Test type change, too. v.BoolValue = true; Assert.Equal(hashCode, v.GetHashCode()); }
public void TestEqualsWithOverride() { var v1 = new Tile.Value { StringValue = "Hello" }; var v2 = new Tile.Value { BoolValue = true }; Assert.False(v1.Equals(v2)); v2 = new Tile.Value { StringValue = "Hello" }; Assert.True(v1.Equals(v2)); }
private void CheckEquals(Tile.Value v1, Tile.Value v2, bool expected) { Assert.Equal(expected, v1.Equals(v2)); Assert.Equal(expected, v2.Equals(v1)); }