public void TestCaseDirectiveEquality() { var directive1 = new RippedOpenDirective( Tag.Parse("IF ? IS (BAD GOOD) TO $ THEN"), Tag.Parse("ELSE IF NOT SET"), Tag.Parse("END ALL $ LIFE")); var directive2 = new RippedOpenDirective( Tag.Parse("if ? is (good bad) to $ then"), Tag.Parse("else if not set"), Tag.Parse("end all $ life")); Assert.AreEqual(directive1, directive1); Assert.IsFalse(directive1.Equals(null, StringComparer.OrdinalIgnoreCase)); Assert.IsTrue(directive1.Equals(directive1, StringComparer.OrdinalIgnoreCase)); Assert.IsTrue(directive1.Equals(directive1, StringComparer.CurrentCulture)); Assert.AreEqual(directive2, directive2); Assert.IsFalse(directive2.Equals(null, StringComparer.OrdinalIgnoreCase)); Assert.IsTrue(directive2.Equals(directive2, StringComparer.OrdinalIgnoreCase)); Assert.IsTrue(directive2.Equals(directive2, StringComparer.CurrentCulture)); Assert.AreNotEqual(directive1, directive2); Assert.IsTrue(directive1.Equals(directive2, StringComparer.OrdinalIgnoreCase)); Assert.IsFalse(directive1.Equals(directive2, StringComparer.CurrentCulture)); Assert.AreNotEqual(directive1.GetHashCode(), directive2.GetHashCode()); Assert.AreEqual(directive1.GetHashCode(StringComparer.CurrentCultureIgnoreCase), directive2.GetHashCode(StringComparer.CurrentCultureIgnoreCase)); }
public void TestCaseDirectiveEqualityExceptions() { var directive1 = new RippedOpenDirective(Tag.Parse("NOTHING")); ExpectArgumentNullException("comparer", () => directive1.Equals(directive1, null)); ExpectArgumentNullException("comparer", () => directive1.GetHashCode(null)); }