/// <summary> ///A test for Equals ///</summary> public void EqualsTest1Helper <E>(E a) where E : class { WeakValueRef <E> target = WeakValueRef <E> .Create(a); object obj = null; // TODO: Initialize to an appropriate value Assert.IsFalse(target.Equals(obj)); obj = new object(); Assert.IsFalse(target.Equals(obj)); obj = WeakValueRef <E> .Create(a); Assert.IsTrue(target.Equals(obj)); }
/// <summary> ///A test for Equals ///</summary> public void EqualsTestHelper <E>(E a, E b) where E : class { WeakValueRef <E> target = WeakValueRef <E> .Create(a); WeakValueRef <E> other = WeakValueRef <E> .Create(b); Assert.IsFalse(target.Equals(other)); other = WeakValueRef <E> .Create(a); Assert.IsTrue(target.Equals(other)); ((WeakReference)target.Reference).Target = null; Assert.IsTrue(target.Equals(target)); ((WeakReference)other.Reference).Target = null; Assert.IsFalse(target.Equals(other)); }