public void TestEquality() { HashCollection <int> a = new HashCollection <int> { 1, 2 }; HashCollection <int> b = new HashCollection <int> { 2, 3 }; HashCollection <int> c = new HashCollection <int> { 1, 2 }; Assert.IsFalse(a == b); Assert.IsTrue(a == c); Assert.IsFalse(null == a); Assert.IsFalse(a == null); Assert.IsTrue(a != b); Assert.IsFalse(a != c); Assert.IsTrue(null != a); Assert.IsTrue(a != null); Assert.AreNotEqual(a, b); Assert.AreEqual(a, c); Assert.AreEqual(a.GetHashCode(), c.GetHashCode()); Assert.IsFalse(a.Equals(b)); Assert.IsTrue(a.Equals(c)); Assert.IsFalse(a.Equals(null)); Assert.IsFalse(a.Equals((ISet)b)); Assert.IsTrue(a.Equals((ISet)c)); Assert.IsFalse(a.Equals((ISet) new HashCollection <int> { 1 })); Assert.IsFalse(a.Equals((ISet)null)); Assert.IsFalse(a.Equals((IEnumerable)b)); Assert.IsTrue(a.Equals((IEnumerable)c)); Assert.IsFalse(a.Equals((IEnumerable)null)); Assert.IsFalse(a.Equals(new[] { 2, 3 })); Assert.IsTrue(a.Equals(new[] { 1, 2 })); Assert.IsFalse(a.Equals((IEnumerable <int>)null)); }