public void Equals_Null_NotEqual() { // Arrange string text = "myText"; string webAddress = "http://google.com"; var name = new NameFragment(text, webAddress); // Act bool equal = name.Equals(null); // Assert Assert.IsFalse(equal, "An instance of NameFragment should never be equal to null."); }
public void Equals_Object_NotEqual() { // Arrange string text = "myText"; string webAddress = "http://google.com"; var name = new NameFragment(text, webAddress); var obj = new Object(); // Act bool equal = name.Equals(obj); // Assert Assert.IsFalse(equal, "An instance of NameFragment should never be equal to a plain object."); }
public void Equals_SameValues_Equal() { // Arrange var name1 = new NameFragment("myText", "http://www.example.com"); var name2 = new NameFragment("myText", "http://www.example.com"); // Act bool equal1 = name1.Equals(name2); bool equal2 = name2.Equals(name1); Assert.IsTrue(equal1, "NameFragments with the same Text and WebAddress values are equal."); Assert.IsTrue(equal2, "NameFragments with the same Text and WebAddress values are equal."); }
public void Equals_DiffQuality_NotEqual() { // Arrange string text = "myText"; var name1 = new NameFragment(text, "http://yahoo.com"); var name2 = new NameFragment(text, "http://google.com"); // Act bool equal1 = name1.Equals(name2); bool equal2 = name2.Equals(name1); // Assert Assert.IsFalse(equal1, "An instance of NameFragment should not be equal if they have different web addresses."); Assert.IsFalse(equal2, "An instance of NameFragment should not be equal if they have different web addresses."); }
public void Equals_DiffQuantity_NotEqual() { // Arrange string webAddress = "http://google.com"; var name1 = new NameFragment("text1", webAddress); var name2 = new NameFragment("text2", webAddress); // Act bool equal1 = name1.Equals(name2); bool equal2 = name2.Equals(name1); // Assert Assert.IsFalse(equal1, "An instance of NameFragment should not be equal if they have different texts."); Assert.IsFalse(equal2, "An instance of NameFragment should not be equal if they have different texts."); }