Equals() 공개 메소드

Determines whether the specified object is equal to this instance.
/// The parameter is null. ///
public Equals ( object obj ) : bool
obj object The to compare with this instance.
리턴 bool
        public void ReferencesIsEqualToTheInstanceItIsReferringTo()
        {
            var instance = new object();
            var reference = new ReferenceEqualWeakReference(instance);

            reference.Equals(instance).Should().BeTrue();
            reference.GetHashCode().Should().Be(instance.GetHashCode());
        }
        public void TwoReferencesReferencingTheSameObjectAreEqual()
        {
            var instance = new object();
            var ref1 = new ReferenceEqualWeakReference(instance);
            var ref2 = new ReferenceEqualWeakReference(instance);

            ref1.Equals(ref2).Should().BeTrue();
            ref1.GetHashCode().Should().Be(ref2.GetHashCode());
        }