public void Invalid_error_handler_argument_tests() { var hostedWorkflows = new WorkflowHost(_domain, new[] { new TestWorkflow1() }); Assert.Throws <ArgumentNullException>(() => hostedWorkflows.OnError(null)); Assert.Throws <ArgumentNullException>(() => hostedWorkflows.OnResponseError(null)); Assert.Throws <ArgumentNullException>(() => hostedWorkflows.OnPollingError(null)); }
public void Status_is_set_to_faulted_when_workflow_host_can_not_handle_exception() { _simpleWorkflow.Setup(s => s.PollForDecisionTaskAsync(It.IsAny <PollForDecisionTaskRequest>(), It.IsAny <CancellationToken>())).Throws <Exception>(); var hostedWorkflows = new WorkflowHost(_domain, new[] { new TestWorkflow1() }); hostedWorkflows.OnError(e => ErrorAction.Unhandled); hostedWorkflows.StartExecution(new TaskList("name")); hostedWorkflows.StopExecution(); Assert.That(hostedWorkflows.Status, Is.EqualTo(HostStatus.Faulted)); }
public void Raise_faulted_event_on_unhandled_exception() { var expectedException = new Exception(); _simpleWorkflow.Setup(s => s.PollForDecisionTaskAsync(It.IsAny <PollForDecisionTaskRequest>(), It.IsAny <CancellationToken>())).Throws(expectedException); Exception actualException = null; var hostedWorkflows = new WorkflowHost(_domain, new[] { new TestWorkflow1() }); hostedWorkflows.OnError(e => ErrorAction.Unhandled); hostedWorkflows.OnFault += (s, e) => actualException = e.Exception; hostedWorkflows.StartExecution(new TaskList("name")); hostedWorkflows.StopExecution(); Assert.That(actualException, Is.EqualTo(expectedException)); }