public void ExpressionAfterNestedAssertion_CombinesChainedExpressions() { TestClass actualExpression = new TestClass(12); int expectedExpression = 2; Assert.Throws<EasyAssertionException>(() => actualExpression .Assert(tc => tc.ShouldBeA<TestClass>()) .And.Value.ShouldBe(expectedExpression)); Assert.AreEqual("actualExpression.Value", SourceExpressionProvider.ForCurrentThread.GetActualExpression()); }
public void ExpressionInsideNestedAssertion_CombinesOuterAndInnerExpressions() { TestClass actualExpression = new TestClass(12); int expectedExpression = 2; Assert.Throws<EasyAssertionException>(() => actualExpression.Assert(a => a.Value.ShouldBe(expectedExpression))); Assert.AreEqual("actualExpression.Value", SourceExpressionProvider.ForCurrentThread.GetActualExpression()); }
public void ExpressionTwoLevelsIn_CombinesOuterMiddleAndInnerExpressions() { TestClass actualExpression = new TestClass(12); Assert.Throws<EasyAssertionException>(() => actualExpression .Assert(a => a.Value.ShouldBe(12) .And(b => b.ToString().ShouldBe("2")))); Assert.AreEqual("actualExpression.Value.ToString()", SourceExpressionProvider.ForCurrentThread.GetActualExpression()); }