public void Equals() { var ext1 = new ExtensionSubtag('a', "aaa"); var ext2 = new ExtensionSubtag('a', "aaa"); var ext3 = new ExtensionSubtag('b', "aaa"); var ext4 = new ExtensionSubtag('b', "bbb"); Assert.IsTrue(ext1.Equals(ext1)); Assert.IsTrue(ext1.Equals(ext2)); Assert.IsFalse(ext2.Equals(ext3)); Assert.IsFalse(ext3.Equals(ext4)); Assert.IsTrue(ext1 != ext3); Assert.IsFalse(ext1 == ext3); }
public void Equals() { var e1 = new ExtensionSubtag(); var e2 = (object)e1; var ext1 = new ExtensionSubtag('a', "aaa"); var ext2 = new ExtensionSubtag('a', "aaa"); var ext3 = new ExtensionSubtag('b', "aaa"); var ext4 = new ExtensionSubtag('x', "bbb"); Assert.IsFalse(e1.Equals(null)); Assert.IsTrue(e1.Equals(e2)); Assert.AreEqual(e1, e1); Assert.AreNotEqual(e1, ext1); Assert.IsTrue(ext1.Equals(ext1)); Assert.IsTrue(ext1.Equals(ext2)); Assert.IsFalse(ext2.Equals(ext3)); Assert.IsFalse(ext3.Equals(ext4)); Assert.IsTrue(ext1 != ext3); Assert.IsFalse(ext1 == ext3); }