public void NotEqualWhenValuesAreDifferent() { var left = new TestString("left"); var right = new TestString("right"); left.Equals(right as object).Should().BeFalse(); left.Equals(right).Should().BeFalse(); (left == right).Should().BeFalse(); (left != right).Should().BeTrue(); }
public void EqualWhenValuesAreEqual() { var left = new TestString("Howdy?"); var right = new TestString("Howdy?"); left.Equals(right as object).Should().BeTrue(); left.Equals(right).Should().BeTrue(); (left == right).Should().BeTrue(); (left != right).Should().BeFalse(); left.GetHashCode().Should().Be(right.GetHashCode()); }
public void EqualWhenContainingWeirdCharacters() { var left = new TestString("Iñtërnâtiônàlizætiøn_𐐒𐐌_あ"); var right = new TestString("Iñtërnâtiônàlizætiøn_𐐒𐐌_あ"); left.Equals(right as object).Should().BeTrue(); left.Equals(right).Should().BeTrue(); (left == right).Should().BeTrue(); (left != right).Should().BeFalse(); left.GetHashCode().Should().Be(right.GetHashCode()); }
public void EqualWhenValuesHaveDifferentCasing() { var left = new TestString("CASELESS"); var right = new TestString("CaSeLeSS"); left.Equals(right as object).Should().BeTrue(); left.Equals(right).Should().BeTrue(); (left == right).Should().BeTrue(); (left != right).Should().BeFalse(); left.GetHashCode().Should().Be(right.GetHashCode()); }
public void NotEqualWhenTheOtherIsNull() { var left = new TestString("left"); TestString?right = null; left.Equals(right as object).Should().BeFalse(); left.Equals(right).Should().BeFalse(); (left == right).Should().BeFalse(); (left != right).Should().BeTrue(); (right == left).Should().BeFalse(); (right != left).Should().BeTrue(); }