Example #1
0
        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();
        }
Example #2
0
        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();
        }