public void Test_workflow_2016_input_output() { //Arrange //Create the workflow mock and set any Input Parameters the workflow might need CrmWorkflowMock workflowMock = new CrmWorkflowMock { WorkflowContext = new FakeWorkflowContext { InputParameters = new ParameterCollection { { "DateToCheck", new DateTime(2012, 5, 7) } } } }; //Act //Execute the workflow var output = workflowMock.Execute <ExampleWorkflow>(); //Assert //Check to see if the output value matches the expected value bool isHoliday = (bool)output["IsPublicHoliday"]; Assert.IsFalse(isHoliday); }
public void Test_workflow_2016_execute_nonvirtual_method() { //Arrange string expected = "Hello World!"; //Create a workflow mock CrmWorkflowMock workflowMock = new CrmWorkflowMock(); //Act //Use the ExecuteMethod method of the workflow mock to execute //a method in the workflow - in this case a method named Test3 string resultString = String.Empty; object result = workflowMock.ExecuteMethod <ExampleWorkflow2>("Test3"); if (result != null) { resultString = result.ToString(); } //Assert //Compare the method result to the expected value Assert.AreEqual(resultString, expected); }