public TryGetHint ( |
||
parser | ||
expression | ||
hint | string | |
Результат | bool |
public void TriggersOnSameObjectForMethodEquals() { var hint = new BrokenEqualityHint(); var x = new object(); Expression<Func<bool>> exp = () => x.Equals(x); string ignored; Assert.IsTrue(hint.TryGetHint(exp.Body, out ignored)); Assert.IsNotNull(ignored); }
public void DoesntTriggerWithDifferingObjectsForOperatorEquals() { var hint = new BrokenEqualityHint(); var x = new object(); var y = new object(); Expression<Func<bool>> exp = () => x == y; string ignored; Assert.IsFalse(hint.TryGetHint(exp.Body, out ignored)); Assert.IsNull(ignored); }
public void PicksUpCorrectTypeForOverriddenMethodEquals() { var hint = new BrokenEqualityHint(); var x = new OverridesEqualsBadly(); Expression<Func<bool>> exp = () => x.Equals(x); string ignored; Assert.IsTrue(hint.TryGetHint(exp.Body, out ignored)); Assert.IsNotNull(ignored); Assert.IsTrue(ignored.Contains(x.GetType().Name)); }