public void ReferenceEqualityTest() { var set = new SimpleSet <TestMember>(); var theObject = new TestMember("hello"); var equalObject = new TestMember("HELLO"); Assert.IsTrue(theObject.Equals(equalObject)); Assert.IsFalse(theObject == equalObject); set.Add(theObject); TestMember containedObject; bool isContained = set.Contains(equalObject, out containedObject); Assert.IsTrue(isContained); Assert.IsTrue(containedObject.Equals(equalObject)); Assert.IsTrue(containedObject == theObject); Assert.IsTrue(containedObject != equalObject); bool isChanged = set.TryAdd(equalObject, out containedObject); Assert.IsFalse(isChanged); Assert.IsTrue(containedObject.Equals(equalObject)); Assert.IsTrue(containedObject == theObject); Assert.IsTrue(containedObject != equalObject); TestMember removedObject; bool wasContained = set.Remove(equalObject, out removedObject); Assert.IsTrue(wasContained); Assert.IsTrue(removedObject.Equals(theObject)); Assert.IsTrue(removedObject == theObject); Assert.IsTrue(removedObject != equalObject); }