public void ShouldCheckEquality(string minorValue1, string minorValue2, bool expectedEqualityResult) { //Given var firstListContent = new ListContent("Name", new[] { new ListItemContent("Header", "value", new ListItemContent("Subheader", "value").AsArray()), new ListItemContent("Header", "value", new [] { new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value2", new ListItemContent("Subsubheader", minorValue1).AsArray()) }) } ); var secondListContent = new ListContent("Name", new[] { new ListItemContent("Header", "value", new ListItemContent("Subheader", "value").AsArray()), new ListItemContent("Header", "value", new [] { new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value2", new ListItemContent("Subsubheader", minorValue2).AsArray()) }) }); //When var result = firstListContent.Equals(secondListContent); //Then result.Should().Be(expectedEqualityResult); }
public void EqualsTest_CompareWithNull_NotEquals() { var firstListContent = new ListContent("Name", new ListItemContent("Header", "value", new ListItemContent("Subheader", "value")), new ListItemContent("Header", "value", new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value", new ListItemContent("Subsubheader1", "value")))); Assert.IsFalse(firstListContent.Equals(null)); }
public void ShouldNotBeEqualToNull() { //Given var firstListContent = new ListContent("Name", new[] { new ListItemContent("Header", "value", new ListItemContent("Subheader", "value").AsArray()), new ListItemContent("Header", "value", new [] { new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value", new ListItemContent("Subsubheader1", "value").AsArray()) }) }); //When var result = firstListContent.Equals(null); //Then result.Should().BeFalse(); }
public void EqualsTest_ValuesAreEqual_Equals() { var firstListContent = new ListContent("Name", new ListItemContent("Header", "value", new ListItemContent("Subheader", "value")), new ListItemContent("Header", "value", new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value2", new ListItemContent("Subsubheader", "value")))); var secondListContent = new ListContent("Name", new ListItemContent("Header", "value", new ListItemContent("Subheader", "value")), new ListItemContent("Header", "value", new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value2", new ListItemContent("Subsubheader", "value")))); Assert.IsTrue(firstListContent.Equals(secondListContent)); }
public void EqualsTest_ValuesDifferByNestedValue_NotEquals() { var firstListContent = new ListContent("Name", new ListItemContent("Header", "value", new ListItemContent("Subheader", "value")), new ListItemContent("Header", "value", new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value", new ListItemContent("Subsubheader1", "value")))); var secondListContent = new ListContent("Name", new ListItemContent("Header", "value", new ListItemContent("Subheader", "value")), new ListItemContent("Header", "value", new ListItemContent("Subheader", "value"), new ListItemContent("Subheader", "value", new ListItemContent("Subsubheader2", "value")))); Assert.IsFalse(firstListContent.Equals(secondListContent)); }