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

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, BotCallbackHandler)

Initializes a new instance of the TestFlow class.

TestFlow(TestAdapter, IBot)

Initializes a new instance of the TestFlow class.

Methods

AssertNoReply(String, UInt32)

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(IActivity, IEqualityComparer<IActivity>, String, UInt32)

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

AssertReply(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.

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.

StartTestAsync()

Starts the execution of the test flow.

Test(IEnumerable<IActivity>, 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(IActivity, String, UInt32) method. Every other activity will be processed as user's message via the Send(IActivity) method.

Test(IEnumerable<IActivity>, 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(IActivity, String, UInt32) method. Every other activity will be processed as user's message via the Send(IActivity) method.

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

Shortcut for calling Send(String) followed by AssertReply(Action<IActivity>, String, UInt32).

Test(String, Activity, String, UInt32)

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

Test(String, String, String, UInt32)

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

Applies to

See also