public void Should_be_equal_if_data_have_same_structure() { var lhs = new ContentData() .AddField("field1", new ContentFieldData() .AddInvariant(2)) .AddField("field2", new ContentFieldData() .AddInvariant(2)); var rhs = new ContentData() .AddField("field1", new ContentFieldData() .AddInvariant(2)) .AddField("field2", new ContentFieldData() .AddInvariant(2)); Assert.True(lhs.Equals(rhs)); Assert.True(lhs.Equals((object)rhs)); Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode()); }
public void Should_not_be_equal_if_data_have_not_same_structure() { var lhs = new ContentData() .AddField("field1", new ContentFieldData() .AddInvariant(2)) .AddField("field2", new ContentFieldData() .AddInvariant(2)); var rhs = new ContentData() .AddField("field1", new ContentFieldData() .AddLocalized("en", 2)) .AddField("field3", new ContentFieldData() .AddInvariant(2)); Assert.False(lhs.Equals(rhs)); Assert.False(lhs.Equals((object)rhs)); Assert.NotEqual(lhs.GetHashCode(), rhs.GetHashCode()); }