Jaa


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.IExtendedUserTokenProvider
type TestAdapter = class
    inherit BotAdapter
    interface IExtendedUserTokenProvider
    interface IUserTokenProvider
Public Class TestAdapter
Inherits BotAdapter
Implements IExtendedUserTokenProvider
Inheritance
TestAdapter
Implements

Constructors

TestAdapter(ConversationReference, Boolean)

Initializes a new instance of the TestAdapter class.

TestAdapter(String, Boolean)

Initializes a new instance of the TestAdapter class.

Fields

BotIdentityKey

The string value for the bot identity key.

(Inherited from BotAdapter)
InvokeResponseKey

The key value for any InvokeResponseActivity that would be on the TurnState.

(Inherited from BotAdapter)
OAuthScopeKey

The string value for the OAuth scope key.

(Inherited from BotAdapter)

Properties

ActiveQueue

Gets the queue of responses from the bot.

Conversation

Gets or sets a reference to the current conversation.

EnableTrace

Gets or sets a value indicating whether to send trace activities.

Locale

Gets or sets the locale for the conversation.

MiddlewareSet

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

(Inherited from BotAdapter)
OnTurnError

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

(Inherited from BotAdapter)

Methods

AddExchangeableToken(String, String, String, String, String)

Adds a fake exchangeable token so it can be exchanged later.

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

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

ContinueConversationAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

(Inherited from BotAdapter)
ContinueConversationAsync(ClaimsIdentity, Activity, String, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

(Inherited from BotAdapter)
ContinueConversationAsync(ClaimsIdentity, ConversationReference, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

(Inherited from BotAdapter)
ContinueConversationAsync(ClaimsIdentity, ConversationReference, String, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

(Inherited from BotAdapter)
ContinueConversationAsync(String, Activity, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

(Inherited from BotAdapter)
ContinueConversationAsync(String, ConversationReference, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

(Inherited from BotAdapter)
CreateConversation(String, String, String)

Create a ConversationReference.

CreateConversationAsync(String, BotCallbackHandler, CancellationToken)

Creates a new conversation on the specified channel.

CreateConversationAsync(String, String, String, String, ConversationParameters, BotCallbackHandler, CancellationToken)

Creates a conversation on the specified channel.

(Inherited from BotAdapter)
CreateTurnContext(Activity)

Creates the turn context for the adapter.

DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken)

Deletes an existing activity in the ActiveQueue.

ExchangeTokenAsync(ITurnContext, AppCredentials, String, String, TokenExchangeRequest, CancellationToken)

Performs a token exchange operation such as for single sign-on.

ExchangeTokenAsync(ITurnContext, String, String, TokenExchangeRequest, CancellationToken)

Performs a token exchange operation such as for single sign-on.

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

Returns a dictionary of TokenResponses for the resource URLs, using customized AppCredentials.

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

Returns a dictionary of TokenResponses for the resource URLs, using the bot's AppCredentials.

GetNextReply()

Dequeues and returns the next bot response from the ActiveQueue.

GetNextReplyAsync(CancellationToken)

Get the next reply async.

GetOauthSignInLinkAsync(ITurnContext, AppCredentials, String, CancellationToken)

Returns a fake link for a sign-in, using customized AppCredentials.

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

Returns a fake link for a sign-in, using customized AppCredentials.

GetOauthSignInLinkAsync(ITurnContext, String, CancellationToken)

Returns a fake link for a sign-in, using the bot's AppCredentials.

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

Returns a fake link for a sign-in, using the bot's AppCredentials.

GetSignInResourceAsync(ITurnContext, AppCredentials, String, String, String, CancellationToken)

Gets a sign-in resource.

GetSignInResourceAsync(ITurnContext, String, CancellationToken)

Gets a sign-in resource.

GetSignInResourceAsync(ITurnContext, String, String, String, CancellationToken)

Gets a sign-in resource.

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

Gets the token statuses, using customized AppCredentials.

GetTokenStatusAsync(ITurnContext, String, String, CancellationToken)

Gets the token statuses, using the bot's app credentials.

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

Attempts to retrieve the token for a user that's in a login flow, using customized AppCredentials.

GetUserTokenAsync(ITurnContext, String, String, CancellationToken)

Attempts to retrieve the token for a user that's in a login flow, using the bot's AppCredentials.

MakeActivity(String)

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

ProcessActivityAsync(Activity, BotCallbackHandler, CancellationToken)

Receives an activity and runs it through the middleware pipeline.

ProcessActivityAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken)

Creates a turn context and runs the middleware pipeline for an incoming activity.

RunPipelineAsync(ITurnContext, BotCallbackHandler, CancellationToken)

Starts activity processing for the current bot turn.

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

Sends activities to the conversation.

SendTextToBotAsync(String, BotCallbackHandler, CancellationToken)

Processes a message activity from a user.

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

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

SignOutUserAsync(ITurnContext, String, String, CancellationToken)

Signs a user out by removing the user's token(s) from mock storage, using the bot's app credentials.

ThrowOnExchangeRequest(String, String, String, String)

Adds an instruction to throw an exception during exchange requests.

UpdateActivityAsync(ITurnContext, Activity, CancellationToken)

Replaces an existing activity in the ActiveQueue.

Use(IMiddleware)

Adds middleware to the adapter's pipeline.

Extension Methods

UseBotState(BotAdapter, BotState[])

Adds middleware to the adapter to register one or more BotState objects on the turn context. The middleware registers the state objects on the turn context at the start of each turn.

UseState(BotAdapter, UserState, ConversationState, Boolean)
Obsolete.

Registers user and conversation state objects with the adapter. These objects will be available via the turn context's TurnState.Get<T>() method.

UseStorage(BotAdapter, IStorage)

Adds middleware to the adapter to register an IStorage object on the turn context. The middleware registers the state objects on the turn context at the start of each turn.

Applies to

See also