public void TestMethod_GetMessage_WrongFieldName() { Assert.Throws <FieldNotFoundException>( () => ExpressionTest <Dummy> .CreateMethodExpression(nameof(Dummy.GetMessage), typeof(Dummy).GetFieldValue(WrongFieldName)) .TestAndVerify()); }
public void TestMethod_CharAt1() { var classInfo = ClassInfo <Dummy> .Create(new Dictionary <string, dynamic> { { MessageField, "012345789" } }); ExpressionTest <Dummy> .CreateMethodExpression(nameof(Dummy.CharAt1), classInfo, "_message[1] == '1'").TestAndVerify(); }
public void TestMethod_GetMessage() { // Solution 1 ExpressionTest <Dummy> .CreateMethodExpression(nameof(Dummy.GetMessage), typeof(Dummy).GetFieldValue(MessageField)) .TestAndVerify(); // Solution 2 // Arrange var dummy = typeof(Dummy) .CreateInstance() as Dummy; // Act var message = dummy?.GetMessage(); // Assert message.ShouldBe(dummy.Evaluate <string>(MessageField)); }
public void TestMethod_MethodWithListAsParameter() { ExpressionTest <Dummy> .CreateMethodExpression(nameof(Dummy.MethodWithListAsParameter), "Test Output-0556 Test Output-1556").TestAndVerify(); }
public void ThrowSystemException() { ExpressionTest <Dummy> .CreateMethodExpression(nameof(Dummy.ThrowSystemException), typeof(System.SystemException).Name).TestAndVerify(); }
public void TestMethod_ReturnMessage_WithWrongExpectedOutput() { Assert.Throws <NoMatchedException>( () => ExpressionTest <Dummy> .CreateMethodExpression(nameof(Dummy.ReturnMessage), "Wrong Expected Output").TestAndVerify()); }
public void TestMethod_WrongMethod() { Assert.Throws <MethodNotFoundException>( () => ExpressionTest <Dummy> .CreateMethodExpression("WrongMethod", null).TestAndVerify()); }
public void TestMethod_GetType() { ExpressionTest <Dummy> .CreateMethodExpression(nameof(GetType), "expunit.framework.tests.TestClass.Dummy").TestAndVerify(); ExpressionTest <Dummy> .CreateMethodOutputExpression(nameof(GetType), "_type").TestAndVerify(); }
public void TestMethod_Empty() { ExpressionTest <Dummy> .CreateMethodExpression(nameof(Dummy.Empty), string.Empty).TestAndVerify(); }