public void ShouldResolve() { Expression <Func <Dummy, int> > expression = f => f.Dummy2.Value2; var resolver = new DefaultCulpritResolver(expression); var dummy = new Dummy() { Dummy2 = new Dummy2() }; var result = resolver.Resolve(dummy).ToArray(); Assert.AreSame(dummy.Dummy2, result[0].Value); Assert.AreEqual(new EquatableExpression(Dummy2Exp(m => m.Value2)), result[0].Expression); }
public void ShouldResolve_Unnormalized() { var expression = DummyExp(d => d.Dummy2.GetCalculatedValue2()); var resolver = new DefaultCulpritResolver(expression); var dummy = new Dummy() { Dummy2 = new Dummy2() }; var result = resolver.Resolve(dummy).ToArray(); //Because expression is not a MemberExpression. The Culprit should stay the root, and the expression should resolve to the same. Assert.AreSame(dummy, result[0].Value); Assert.AreEqual(new EquatableExpression(DummyExp(d => d.Dummy2.GetCalculatedValue2())), result[0].Expression); }