/// <summary> /// Adds an assertion that the turn processing logic responds as expected. /// </summary> /// <param name="validateActivity">A validation method to apply to an activity from the bot. /// This activity should throw an exception if validation wfails.</param> /// <param name="description">A message to send if the actual response is not as expected.</param> /// <param name="timeout">The amount of time in milliseconds within which a response is expected.</param> /// <returns>A new <see cref="TestFlow"/> object that appends this assertion to the modeled exchange.</returns> /// <remarks>This method does not modify the original <see cref="TestFlow"/> object.</remarks> public TestFlow AssertReply(Action <IActivity> validateActivity, [CallerMemberName] string description = null, uint timeout = 3000) { return(new TestFlow( async() => { // NOTE: See details code in above method. await this._testTask.ConfigureAwait(false); if (System.Diagnostics.Debugger.IsAttached) { timeout = uint.MaxValue; } CancellationTokenSource cts = new CancellationTokenSource(); cts.CancelAfter((int)timeout); IActivity replyActivity = await _adapter.GetNextReplyAsync(cts.Token).ConfigureAwait(false); validateActivity(replyActivity); return; }, this)); }