コード例 #1
0
        public async Task MainDialog_DynamicMainDialog()
        {
            var convoState = new ConversationState(new MemoryStorage());

            var adapter = new TestAdapter()
                          .Use(new AutoSaveStateMiddleware(convoState));

            var mainDialog = new MainDialog(convoState.CreateProperty <DialogState>("dialogState"));

            mainDialog
            .AddDialog(WaterfallTests.Create_Waterfall3())
            .AddDialog(WaterfallTests.Create_Waterfall4())
            .AddDialog(WaterfallTests.Create_Waterfall5());

            await new TestFlow(adapter, async(turnContext, cancellationToken) =>
            {
                await mainDialog.RunAsync(turnContext).ConfigureAwait(false);
            })
            .Send("hello")
            .AssertReply("step1")
            .AssertReply("step1.1")
            .Send("hello")
            .AssertReply("step1.2")
            .Send("hello")
            .AssertReply("step2")
            .AssertReply("step2.1")
            .Send("hello")
            .AssertReply("step2.2")
            .StartTestAsync();
        }
コード例 #2
0
        public TestMainDialog(IStatePropertyAccessor <DialogState> state)
            : base(state, nameof(MainDialog))
        {
            this.DialogStateProperty = state;

            AddDialog(WaterfallTests.Create_Waterfall3());
            AddDialog(WaterfallTests.Create_Waterfall4());
            AddDialog(WaterfallTests.Create_Waterfall5());
        }