public void InvokeWithExtensions() { var childActivity = new TestActivityWithExtensions(); var target = new InvokeWorkflow(); var incStore = new IncrementStore(); var decStore = new DecrementStore(); var extensions = new object[] { incStore, decStore }; dynamic innerInput = new WorkflowArguments(); innerInput.Num = 3; dynamic input = new WorkflowArguments(); input.Activity = childActivity; input.Input = innerInput; input.Extensions = extensions; // inner dictionary gets passed to child var host = WorkflowInvokerTest.Create(target); try { host.TestActivity(input); Assert.AreEqual(4, incStore.Value); Assert.AreEqual(2, decStore.Value); } finally { host.Tracking.Trace(); } }
public void InvokeWorkflowShouldInvokeInner() { WorkflowTestTrace.Arrange(); var childActivity = new TestInnerActivity(); var target = new InvokeWorkflow(); // inner dictionary gets passed to child var innerInput = InputDictionary.Create("Num", 1); var input = InputDictionary.Create("Activity", childActivity, "Input", innerInput); var host = WorkflowApplicationTest.Create(target, input); try { WorkflowTestTrace.Act(); host.TestWorkflowApplication.RunEpisode(); host.AssertOutArgument.IsNotNull("Result"); var innerArgs = OutputDictionary.Get<IDictionary<string, object>>(host.Results.Output, "Result"); WorkflowTestTrace.Assert(); AssertOutArgument.AreEqual(innerArgs, "Result", 2); } finally { host.Tracking.Trace(); } }
public void InvokeWorkflowShouldThrowTimeoutException() { var childActivity = new TestTimeoutActivity(); var target = new InvokeWorkflow(); // inner dictionary gets passed to child var innerInput = InputDictionary.Create("DelayTime", TimeSpan.FromSeconds(30)); var input = InputDictionary.Create("Activity", childActivity, "Input", innerInput); var host = WorkflowApplicationTest.Create(target, input); try { AssertHelper.Throws<TimeoutException>( () => host.TestWorkflowApplication.RunEpisode(TimeSpan.FromMilliseconds(100))); } finally { host.Tracking.Trace(TrackingOption.All); } }
public void InvokeWorkflowShouldThrow() { var childActivity = new TestInnerActivity(); var target = new InvokeWorkflow(); // inner dictionary gets passed to child var innerInput = InputDictionary.Create("Num", -1); var input = InputDictionary.Create("Activity", childActivity, "Input", innerInput); var host = WorkflowApplicationTest.Create(target, input); try { AssertHelper.Throws<ArgumentException>(() => host.TestWorkflowApplication.RunEpisode()); } finally { host.Tracking.Trace(); } }