public void Equals_OneNullArgument_EqualsPredicateInvocationNotNeeded(string first, string second) { var spy = new EqualitySpy(); Func <string, string, bool> equal = spy.GetEquals <string>(true); IEqualityComparer <string> subject = new DelegatedEqualizer <string>(equal, Hasher.Zero); subject.Equals(first, second); Assert.That(spy.EqualsCalled, Is.False); }
public void Equals_BothNull_EqualsPredicateInvocationNotNeeded() { var spy = new EqualitySpy(); Func <string, string, bool> notEqual = spy.GetEquals <string>(false); IEqualityComparer <string> subject = new DelegatedEqualizer <string>(notEqual, Hasher.Zero); subject.Equals(null, null); Assert.That(spy.EqualsCalled, Is.False); }
public void Ctor() { var spy = new EqualitySpy(); var subject = new DelegatedEqualizer <int>( spy.GetEquals <int>(false), spy.GetHashCode <int>(42)); Assert.That(subject.Equals(1, 1), Is.False); Assert.That(spy.EqualsCalled, Is.True); Assert.That(subject.GetHashCode(1), Is.EqualTo(42)); Assert.That(spy.GetHashCodeCalled, Is.True); }