public void EqualsTest() { const string text1 = "one"; const string text2 = "qwerty"; var alphabet1 = new Alphabet(text1); var alphabet2 = new Alphabet(text1); var alphabet3 = new Alphabet(text2); Assert.IsTrue(alphabet1.Equals(alphabet2)); Assert.IsTrue(alphabet2.Equals(alphabet1)); Assert.IsFalse(alphabet1.Equals(alphabet3)); Assert.IsFalse(alphabet2.Equals(alphabet3)); Assert.IsTrue(alphabet1 == alphabet2); Assert.IsTrue(alphabet2 == alphabet1); Assert.IsFalse(alphabet1 == alphabet3); Assert.IsFalse(alphabet2 == alphabet3); Assert.IsFalse(alphabet1 != alphabet2); Assert.IsFalse(alphabet2 != alphabet1); Assert.IsTrue(alphabet1 != alphabet3); Assert.IsTrue(alphabet2 != alphabet3); }
public void EqualsNullTest() { var alphabet = new Alphabet("one"); Assert.IsFalse(alphabet.Equals(null)); Assert.IsFalse(alphabet.Equals((object)null)); Assert.IsFalse(alphabet == null); Assert.IsTrue((Alphabet)null == null); }
public void EqualsOtherTypeTest() { const string text = "one"; var alphabet = new Alphabet(text); Assert.IsFalse(alphabet.Equals(text)); }