public void ToFormattedStringIsFormatted() { // Arrange const string Expected = @"2: Activity [1] ""EchoArg<Int32>"" is Executing { Arguments { Value: 123 } } "; WorkflowTrace.Information("Arrange"); var activity = new EchoArg<int> { Value = new InArgument<int>(123) }; var tracker = new ActivityStateTracker(); var workflow = WorkflowApplicationTest.Create(activity); workflow.Extensions.Add(tracker); // Act try { WorkflowTrace.Information("Act"); // Run until idle with the Test extension workflow.TestWorkflowApplication.RunEpisode(); var actual = tracker.Records[0].ToFormattedString(); // Assert Assert.AreEqual(Environment.NewLine + Expected, Environment.NewLine + actual); } finally { workflow.Tracking.Trace(); } }
/// <summary> /// <para>Begins an asynchronous send to the app route.</para> /// </summary> /// <param name="query">The string that you'd like to be echoed back to you.</param> /// <param name="callback">The method to be called when the asynchronous send is /// completed.</param> /// <param name="callbackState">A user provided object that distinguished this send /// from other send requests.</param> /// <returns>An object that represents the asynchronous send request.</returns> public sys.IAsyncResult BeginApp(string query = "", sys.AsyncCallback callback = null, object callbackState = null) { var echoArg = new EchoArg(query); return(this.BeginApp(echoArg, callback, callbackState)); }
public void RunWithInvalidArgShouldThrow() { // Arrange TestTrace.Arrange(); var activity = new EchoArg<int>(); using (var workflow = new WorkflowP1(activity) { Extensions = { new ListTrackingParticipant() } }) { // Intentionally used wrong name workflow.Inputs.Input1 = 123; try { // Act TestTrace.Act(); // Assert TestTrace.Assert(); AssertHelper.Throws<ArgumentException>(workflow.RunAsync()); } finally { TestTrace.Finally(); workflow.Trace(); } } }
public void RunWithArgsSimple() { var activity = new EchoArg<int>(); var workflow = new WorkflowP1(activity); // Setup EchoArg.Value in argument workflow.Inputs.Value = 123; var result = workflow.Until.Complete.Run(); // Access EchoArg.Result out argument Assert.AreEqual(123, result.Outputs.Result); }
/// <summary> /// A sample method using async /// </summary> /// <param name="value"> /// The value. /// </param> /// <returns> /// A task /// </returns> private static async Task<WorkflowResult> RunSequenceAsync(int value) { var activity = new EchoArg<int> { Value = value }; return await Workflow.RunAsync(activity); }
/// <summary> /// <para>This endpoint performs App Authentication, validating the supplied app key /// and secret, and returns the supplied string, to allow you to test your code and /// connection to the Dropbox API. It has no other effect. If you receive an HTTP 200 /// response with the supplied query, it indicates at least part of the Dropbox API /// infrastructure is working and that the app key and secret valid.</para> /// </summary> /// <param name="query">The string that you'd like to be echoed back to you.</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> public t.Task <EchoResult> AppAsync(string query = "") { var echoArg = new EchoArg(query); return(this.AppAsync(echoArg)); }
/// <summary> /// <para>Begins an asynchronous send to the app route.</para> /// </summary> /// <param name="echoArg">The request parameters.</param> /// <param name="callback">The method to be called when the asynchronous send is /// completed.</param> /// <param name="state">A user provided object that distinguished this send from other /// send requests.</param> /// <returns>An object that represents the asynchronous send request.</returns> public sys.IAsyncResult BeginApp(EchoArg echoArg, sys.AsyncCallback callback, object state = null) { var task = this.AppAsync(echoArg); return(enc.Util.ToApm(task, callback, state)); }
/// <summary> /// <para>This endpoint performs App Authentication, validating the supplied app key /// and secret, and returns the supplied string, to allow you to test your code and /// connection to the Dropbox API. It has no other effect. If you receive an HTTP 200 /// response with the supplied query, it indicates at least part of the Dropbox API /// infrastructure is working and that the app key and secret valid.</para> /// </summary> /// <param name="echoArg">The request parameters</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> public t.Task <EchoResult> AppAsync(EchoArg echoArg) { return(this.Transport.SendRpcRequestAsync <EchoArg, EchoResult, enc.Empty>(echoArg, "api", "/check/app", "app", global::Dropbox.Api.Check.EchoArg.Encoder, global::Dropbox.Api.Check.EchoResult.Decoder, enc.EmptyDecoder.Instance)); }