TestAdapter TestAdapter TestAdapter Class

Definition

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

public class TestAdapter : Microsoft.Bot.Builder.BotAdapter, Microsoft.Bot.Builder.IUserTokenProvider
type TestAdapter = class
    inherit BotAdapter
    interface IUserTokenProvider
Public Class TestAdapter
Inherits BotAdapter
Implements IUserTokenProvider
Inheritance
TestAdapterTestAdapterTestAdapter
Implements

Constructors

TestAdapter(ConversationReference, Boolean) TestAdapter(ConversationReference, Boolean) TestAdapter(ConversationReference, Boolean)

Initializes a new instance of the TestAdapter class.

Properties

ActiveQueue ActiveQueue ActiveQueue

Gets the queue of responses from the bot.

Conversation Conversation Conversation

Gets or sets a reference to the current coversation.

MiddlewareSet MiddlewareSet MiddlewareSet

Gets the collection of middleware in the adapter's pipeline.

(Inherited from BotAdapter)
OnTurnError OnTurnError OnTurnError

Gets or sets an error handler that can catche exceptions in the middleware or application.

(Inherited from BotAdapter)

Methods

AddUserToken(String, String, String, String, String) AddUserToken(String, String, String, String, String) AddUserToken(String, String, String, String, String)

Adds a fake user token so it can later be retrieved.

ContinueConversationAsync(String, ConversationReference, BotCallbackHandler, CancellationToken) ContinueConversationAsync(String, ConversationReference, BotCallbackHandler, CancellationToken) ContinueConversationAsync(String, ConversationReference, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

(Inherited from BotAdapter)
CreateConversationAsync(String, BotCallbackHandler, CancellationToken) CreateConversationAsync(String, BotCallbackHandler, CancellationToken) CreateConversationAsync(String, BotCallbackHandler, CancellationToken)

Creates a new conversation on the specified channel.

DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken) DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken) DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken)

Deletes an existing activity in the ActiveQueue.

GetAadTokensAsync(ITurnContext, String, String[], String, CancellationToken) GetAadTokensAsync(ITurnContext, String, String[], String, CancellationToken) GetAadTokensAsync(ITurnContext, String, String[], String, CancellationToken)

Returns a dictionary of TokenResponses for the resource URLs.

GetNextReply() GetNextReply() GetNextReply()

Dequeues and returns the next bot response from the ActiveQueue.

GetOauthSignInLinkAsync(ITurnContext, String, CancellationToken) GetOauthSignInLinkAsync(ITurnContext, String, CancellationToken) GetOauthSignInLinkAsync(ITurnContext, String, CancellationToken)

Returns a fake link for a sign-in.

GetOauthSignInLinkAsync(ITurnContext, String, String, String, CancellationToken) GetOauthSignInLinkAsync(ITurnContext, String, String, String, CancellationToken) GetOauthSignInLinkAsync(ITurnContext, String, String, String, CancellationToken)

Returns a fake link for a sign-in.

GetTokenStatusAsync(ITurnContext, String, String, CancellationToken) GetTokenStatusAsync(ITurnContext, String, String, CancellationToken) GetTokenStatusAsync(ITurnContext, String, String, CancellationToken)

Gets the token statuses.

GetUserTokenAsync(ITurnContext, String, String, CancellationToken) GetUserTokenAsync(ITurnContext, String, String, CancellationToken) GetUserTokenAsync(ITurnContext, String, String, CancellationToken)

Attempts to retrieve the token for a user that's in a login flow.

MakeActivity(String) MakeActivity(String) MakeActivity(String)

Creates a message activity from text and the current conversational context.

ProcessActivityAsync(Activity, BotCallbackHandler, CancellationToken) ProcessActivityAsync(Activity, BotCallbackHandler, CancellationToken) ProcessActivityAsync(Activity, BotCallbackHandler, CancellationToken)

Receives an activity and runs it through the middleware pipeline.

RunPipelineAsync(ITurnContext, BotCallbackHandler, CancellationToken) RunPipelineAsync(ITurnContext, BotCallbackHandler, CancellationToken) RunPipelineAsync(ITurnContext, BotCallbackHandler, CancellationToken)

Starts activity processing for the current bot turn.

(Inherited from BotAdapter)
SendActivitiesAsync(ITurnContext, Activity[], CancellationToken) SendActivitiesAsync(ITurnContext, Activity[], CancellationToken) SendActivitiesAsync(ITurnContext, Activity[], CancellationToken)

Sends activities to the conversation.

SendTextToBotAsync(String, BotCallbackHandler, CancellationToken) SendTextToBotAsync(String, BotCallbackHandler, CancellationToken) SendTextToBotAsync(String, BotCallbackHandler, CancellationToken)

Processes a message activity from a user.

SignOutUserAsync(ITurnContext, String, String, CancellationToken) SignOutUserAsync(ITurnContext, String, String, CancellationToken) SignOutUserAsync(ITurnContext, String, String, CancellationToken)

Signs a user out by remove the user's token(s) from mock storage.

UpdateActivityAsync(ITurnContext, Activity, CancellationToken) UpdateActivityAsync(ITurnContext, Activity, CancellationToken) UpdateActivityAsync(ITurnContext, Activity, CancellationToken)

Replaces an existing activity in the ActiveQueue.

Use(IMiddleware) Use(IMiddleware) Use(IMiddleware)

Adds middleware to the adapter's pipeline.

Applies to

See also