public void TestMethod_GetMessage_WithUserDefinedFields() { var classInfo = ClassInfo <Dummy> .Create(new Dictionary <string, object> { { MessageField, "CustomMessage" } }); ExpressionTest <Dummy> .CreateTest(MessageField, classInfo, "CustomMessage").TestAndVerify(); }
public void TestMethod_AddLongItems() { ExpressionTest <Dummy> .CreateTest(nameof(Dummy.AddLongItems), "_longList.Count", 50).TestAndVerify(); TypeUtility.InitializeInstanceCollectionFields = false; ExpressionTest <Dummy> .CreateTest(nameof(Dummy.AddLongItems), "_longList.Count", 25).TestAndVerify(); TypeUtility.InitializeInstanceCollectionFields = true; }
public void TestMethod_AddItem() { ExpressionTest <Dummy> .CreateTest(nameof(Dummy.AddItem), "_classList.Count", 26).TestAndVerify(); TypeUtility.InitializeInstanceCollectionFields = false; ExpressionTest <Dummy> .CreateTest(nameof(Dummy.AddItem), "_classList.Count", 1).TestAndVerify(); TypeUtility.InitializeInstanceCollectionFields = true; }
public void TestMethods_UsingExpressions() { var methods = new List <Expression <Dummy> > { Expression <Dummy> .Create(nameof(GetType), ExpressionTest <Dummy> .CreateTest("Name", "Dummy")), Expression <Dummy> .Create(nameof(GetType), ExpressionTest <Dummy> .CreateTest("GetFields[0].Name", "DummyClassType")) }; _tester.TestAndVerifyMethods(methods); }
public void TestMethod_ReturnMessage() { // Arrange var methods = new List <Expression <Dummy> > { Expression <Dummy> .Create(nameof(Dummy.ReturnMessage), new object[] { "ExpressionTest-1", "ExpressionTest-2" }, ExpressionTest <Dummy> .CreateTest("ExpressionTest-1 ExpressionTest-2")) }; // Assert _tester.TestAndVerifyMethods(methods); }
public void TestMethod_GetSquareRoot() { const double expectedOutput = 25.9422435421457; // Solution 1 ExpressionTest <Dummy> .CreateTest(SquareRootMethod, expectedOutput).TestAndVerify(); // Solution 2 // Arrange var dummy = new Dummy(); // Act var result = dummy.Evaluate <double>(SquareRootMethod); // Assert result.ShouldBe(expectedOutput); }
public void TestMethod_Message_ClassWithNoConstructor() { ExpressionTest <DummyWithNoConstructor> .CreateTest(nameof(DummyWithNoConstructor.Message), "Test_Message").TestAndVerify(); }
public void TestMethod_ReturnCharacter() { ExpressionTest <Dummy> .CreateTest(nameof(Dummy.ReturnCharacter), 'a').TestAndVerify(); }
public void TestMethod_WithUserDefinedParameters() { Expression <Dummy> .Create("ReturnMessage2", new object[] { "Test" }, ExpressionTest <Dummy> .CreateTest("Test")).TestAndVerify(); }
public void TestMethod_WithNullParameters() { Expression <Dummy> .CreateWithNullParameters("ReturnMessage2", ExpressionTest <Dummy> .CreateTest(null)).TestAndVerify(); }