Example #1
0
        public void TestNotResponding()
        {
            WhatsYourName dialogUnit = new WhatsYourName();
            DialogContext context    = new DialogContext();

            DialogUnitTestUtils.TestNotResponding(dialogUnit, context, "привет");
        }
Example #2
0
        public void TestAsking(string response, string expectedName)
        {
            WhatsYourName dialogUnit = new WhatsYourName();
            DialogContext context    = new DialogContext();

            DialogUnitTestUtils.TestInitiating(dialogUnit, context, "Как тебя зовут?", response);
            ClientName clientName = context.GetItem <ClientName>();

            Assert.NotNull(clientName);
            Assert.Equal(expectedName, clientName.Value);
        }
Example #3
0
        public void TestNext()
        {
            Greetings       greetings       = new Greetings();
            WhatsYourName   whatsYourName   = new WhatsYourName();
            QuestionsCanAsk questionsCanAsk = new QuestionsCanAsk();

            DialogPlanItem[] items = new DialogPlanItem[]
            {
                new DialogPlanItem(new DialogUnit[] { greetings, whatsYourName }),

                new DialogPlanItem(
                    questionsCanAsk,
                    (context) => context.HasItem <ClientName>())
            };

            DialogPlan    dialogPlan    = new DialogPlan(items);
            DialogContext dialogContext = new DialogContext();

            Assert.Equal(new DialogUnit[] { greetings, whatsYourName }, dialogPlan.Next(dialogContext));
            Assert.Empty(dialogPlan.Next(dialogContext));

            dialogContext.Upsert(new ClientName(null));
            Assert.Equal(new DialogUnit[] { questionsCanAsk }, dialogPlan.Next(dialogContext));
        }