ภาษา

TestFlow Class

Definition

A mock channel that can be used for unit testing of bot logic.

public class TestFlow
type TestFlow = class
Public Class TestFlow
Inheritance
TestFlow

Remarks

You can use this class to mimic input from a a user or a channel to validate that the bot or adapter responds as expected.

Constructors

Name Description
TestFlow(Func<Task>, TestFlow)

Initializes a new instance of the TestFlow class from an existing flow.

TestFlow(Task, TestFlow)

Initializes a new instance of the TestFlow class from an existing flow.

TestFlow(TestAdapter, AgentCallbackHandler)

Initializes a new instance of the TestFlow class.

TestFlow(TestAdapter, IAgent)

Initializes a new instance of the TestFlow class.

Methods

Name Description
AssertNoMoreReplies(String, UInt32)

Asserts that no further reply arrives within timeout milliseconds. If a reply does arrive, throws InvalidOperationException.

AssertNoReply(String, UInt32)
Obsolete.

Adds an assertion that the turn processing logic finishes responding as expected.

AssertReply(Action<IActivity>, String, UInt32)

Adds an assertion that the turn processing logic responds as expected.

AssertReply(Activity, String, UInt32)

Adds an assertion that the turn processing logic responds as expected.

AssertReply(IActivity, IEqualityComparer<IActivity>, String, UInt32)

Adds an assertion that the turn processing logic responds as expected.

AssertReply(String, String, UInt32)

Adds an assertion that the turn processing logic responds as expected.

AssertReplyContains(String, String, UInt32)

Adds an assertion that the turn processing logic responds as expected.

AssertReplyOneOf(String[], String, UInt32)

Adds an assertion that the bot's response is contained within a set of acceptable responses.

AssertReplySatisfies(Func<IActivity,Task>, String, UInt32)

Asserts the next reply satisfies an async validation delegate. Exceptions from the delegate propagate as-is (no wrapping).

AssertReplySatisfies(IResponseValidator, String, UInt32)

Asserts the next reply satisfies an IResponseValidator. Exceptions from the validator propagate as-is (no wrapping).

AssertTypingIndicator(String, UInt32)

Dequeues the next activity and asserts it is a typing indicator (Typing). Chain this before the reply assertions to match the agent's send order.

Delay(TimeSpan)

Adds a delay in the conversation.

Delay(UInt32)

Adds a delay in the conversation.

Send(IActivity)

Adds an activity from the user to the bot.

Send(String)

Adds a message activity from the user to the bot.

SendConversationUpdate()

Creates a conversation update activity and process it the activity.

SendConversationUpdate(IEnumerable<ChannelAccount>)

Creates a conversation update activity with explicit members added and processes it.

StartTestAsync()

Starts the execution of the test flow.

Test(IEnumerable<Activity>, String, UInt32)

Shortcut for adding an arbitrary exchange between the user and bot. Each activity with a From.Role equals to "bot" will be processed with the AssertReply(Activity, String, UInt32) method. Every other activity will be processed as user's message via the Send(Activity) method.

Test(IEnumerable<Activity>, ValidateReply, String, UInt32)

Shortcut for adding an arbitrary exchange between the user and bot. Each activity with a From.Role equals to "bot" will be processed with the AssertReply(Activity, String, UInt32) method. Every other activity will be processed as user's message via the Send(Activity) method.

Test(String, Action<IActivity>, String, UInt32)

Shortcut for calling Send(String) followed by AssertReply(Action{Activity}, string, uint).

Test(String, Activity, String, UInt32)

Shortcut for calling Send(String) followed by AssertReply(Activity, String, UInt32).

Test(String, String, String, UInt32)

Shortcut for calling Send(String) followed by AssertReply(String, String, UInt32).

Applies to

See also