public async Task ReplaceDialogBranchAsync() { var conversationState = new ConversationState(new MemoryStorage()); var dialogStateAccessor = conversationState.CreateProperty <DialogState>("dialogState"); var adapter = new TestAdapter(); var dialog = new FirstDialog(); await new TestFlow(adapter, async(turnContext, cancellationToken) => { await dialog.RunAsync(turnContext, dialogStateAccessor, cancellationToken); await conversationState.SaveChangesAsync(turnContext, false, cancellationToken); }) .Send("hello") .AssertReply("prompt one") .Send("hello") .AssertReply("prompt two") .Send("replace") .AssertReply("*** WaterfallDialog End ***") .AssertReply("prompt four") .Send("hello") .AssertReply("prompt five") .Send("hello") .StartTestAsync(); }
public async Task ReplaceDialogBranchAsync() { var dialog = new FirstDialog(); var storage = new MemoryStorage(); var userState = new UserState(storage); var conversationState = new ConversationState(storage); var adapter = new TestAdapter() .UseStorage(storage) .UseBotState(userState, conversationState); var dialogManager = new DialogManager(dialog); await new TestFlow((TestAdapter)adapter, async(turnContext, cancellationToken) => { await dialogManager.OnTurnAsync(turnContext, cancellationToken: cancellationToken).ConfigureAwait(false); }) .Send("hello") .AssertReply("prompt one") .Send("hello") .AssertReply("prompt two") .Send("replace") .AssertReply("*** WaterfallDialog End ***") .AssertReply("prompt four") .Send("hello") .AssertReply("prompt five") .Send("hello") .StartTestAsync(); }
public async Task ReplaceDialogTelemetryClientNotNull() { var botTelemetryClient = new Mock <IBotTelemetryClient>(); var dialog = new FirstDialog(); var storage = new MemoryStorage(); var userState = new UserState(storage); var conversationState = new ConversationState(storage); var adapter = new TestAdapter() .UseStorage(storage) .UseBotState(userState, conversationState); var dialogManager = new DialogManager(dialog); await new TestFlow((TestAdapter)adapter, async(turnContext, cancellationToken) => { await dialogManager.OnTurnAsync(turnContext, cancellationToken: cancellationToken).ConfigureAwait(false); Assert.NotNull(dialog.TelemetryClient); }) .Send("hello") .StartTestAsync(); }
public async Task ReplaceDialogTelemetryClientNotNull() { var conversationState = new ConversationState(new MemoryStorage()); var dialogStateAccessor = conversationState.CreateProperty <DialogState>("dialogState"); var botTelemetryClient = new Mock <IBotTelemetryClient>(); var adapter = new TestAdapter(); var dialog = new FirstDialog() { TelemetryClient = botTelemetryClient.Object, }; await new TestFlow(adapter, async(turnContext, cancellationToken) => { await dialog.RunAsync(turnContext, dialogStateAccessor, cancellationToken); await conversationState.SaveChangesAsync(turnContext, false, cancellationToken); Assert.AreEqual(dialog.TelemetryClient, botTelemetryClient.Object); }) .Send("hello") .StartTestAsync(); }