ภาษา

TestAdapter Class

Definition

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

public class TestAdapter : Microsoft.Agents.Builder.ChannelAdapter
type TestAdapter = class
    inherit ChannelAdapter
Public Class TestAdapter
Inherits ChannelAdapter
Inheritance
TestAdapter

Constructors

Name Description
TestAdapter(ConversationReference, Boolean, ILogger, IUserTokenClient)

Initializes a new instance of the TestAdapter class.

TestAdapter(String, Boolean, ILogger, IUserTokenClient)

Initializes a new instance of the TestAdapter class.

Fields

Name Description
InvokeResponseKey

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

(Inherited from ChannelAdapter)

Properties

Name Description
ActiveQueue

Gets the queue of responses from the bot.

ClaimsIdentity
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.

Logger

Logger for the Adapter.

(Inherited from ChannelAdapter)
MiddlewareSet

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

(Inherited from ChannelAdapter)
OnTurnError

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

(Inherited from ChannelAdapter)

Methods

Name Description
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, ConversationReference, AgentCallbackHandler, CancellationToken)

Continues a conversation in a new Turn. This is typically used for proactive interactions.

(Inherited from ChannelAdapter)
ContinueConversationAsync(ClaimsIdentity, ConversationReference, String, AgentCallbackHandler, CancellationToken)

Continues a conversation in a new Turn. This is typically used for proactive interactions.

(Inherited from ChannelAdapter)
ContinueConversationAsync(ClaimsIdentity, IActivity, AgentCallbackHandler, CancellationToken)

Sends a proactive message to a conversation. See ProcessProactiveAsync(ClaimsIdentity, IActivity, String, AgentCallbackHandler, CancellationToken).

(Inherited from ChannelAdapter)
ContinueConversationAsync(ClaimsIdentity, IActivity, String, AgentCallbackHandler, CancellationToken)

Continues a conversation in a new Turn. This is typically used for proactive interactions.

(Inherited from ChannelAdapter)
ContinueConversationAsync(String, ConversationReference, AgentCallbackHandler, CancellationToken)
Obsolete.

Continues a conversation in a new Turn. This is typically used for proactive interactions.

(Inherited from ChannelAdapter)
ContinueConversationAsync(String, IActivity, AgentCallbackHandler, CancellationToken)
Obsolete.

Continues a conversation in a new Turn. This is typically used for proactive interactions.

(Inherited from ChannelAdapter)
Create(String, String, String, String, String, String, String, Boolean, ILogger, IUserTokenClient)

Creates a new TestAdapter with a pre-configured ConversationReference. All parameters use the same defaults as TestAdapter(ConversationReference, Boolean, ILogger, IUserTokenClient).

CreateConversation(String, String, String)

Create a ConversationReference.

CreateConversationAsync(ClaimsIdentity, String, String, String, ConversationParameters, AgentCallbackHandler, CancellationToken)

Creates a conversation on the specified channel and executes a turn with the proper context for the new conversation.

(Inherited from ChannelAdapter)
CreateConversationAsync(String, AgentCallbackHandler, CancellationToken)

Creates a new conversation on the specified channel.

CreateConversationAsync(String, String, String, String, ConversationParameters, AgentCallbackHandler, CancellationToken)

Creates a conversation on the specified channel and executes a turn with the proper context for the new conversation.

(Inherited from ChannelAdapter)
CreateTurnContext(IActivity, ClaimsIdentity)

Creates the turn context for the adapter.

DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken)

Deletes an existing activity in the ActiveQueue.

GetActivitySnapshot()

Returns a thread-safe snapshot of the current contents of the ActiveQueue.

GetNextReply()

Dequeues and returns the next bot response from the ActiveQueue.

GetNextReplyAsync(CancellationToken)

Get the next reply async.

MakeActivity(String)

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

ProcessActivityAsync(ClaimsIdentity, IActivity, AgentCallbackHandler, CancellationToken)

Receives an activity and runs it through the middleware pipeline.

ProcessActivityAsync(IActivity, AgentCallbackHandler, CancellationToken)
ProcessProactiveAsync(ClaimsIdentity, IActivity, IAgent, CancellationToken, String)
ProcessProactiveAsync(ClaimsIdentity, IActivity, String, AgentCallbackHandler, CancellationToken)

The implementation for continue conversation.

RunPipelineAsync(ITurnContext, AgentCallbackHandler, CancellationToken)

Starts activity processing for the current Agent turn.

(Inherited from ChannelAdapter)
SendActivitiesAsync(ITurnContext, IActivity[], CancellationToken)

Sends activities to the conversation.

SendTextToBotAsync(String, AgentCallbackHandler, CancellationToken)

Processes a message activity from a user.

ThrowOnExchangeRequest(String, String, String, String)

Adds an instruction to throw an exception during exchange requests.

UpdateActivityAsync(ITurnContext, IActivity, CancellationToken)

Replaces an existing activity in the ActiveQueue.

Use(IMiddleware)

Adds middleware to the adapter's pipeline.

Applies to

See also