public void Clients_DoNotHaveToCareAboutNulls() { var notNull = new EqualitySubject("a", 1, 1m); var chainable = new SelectorEqualizer <EqualitySubject, int>(s => s.I); Assert.That(chainable.Equals(notNull, null), Is.False); Assert.That(chainable.Equals(null, notNull), Is.False); Assert.That(chainable.Equals(null, null), Is.True); }
public void Chaining_IsDestructive() { EqualitySubject x1 = new EqualitySubject("x", 1, 1m), x2 = new EqualitySubject("x", 1, 2m); ChainableEqualizer <EqualitySubject> sAndI = new SelectorEqualizer <EqualitySubject, string>(s => s.S) .Then(s => s.I); Assert.That(sAndI.Equals(x1, x2), Is.True); var allProp = sAndI.Then(Eq <EqualitySubject> .By(s => s.D)); Assert.That(allProp.Equals(x1, x2), Is.False); Assert.That(sAndI.Equals(x1, x2), Is.False); }