Esempio n. 1
0
        public async Task RunSendPiplineWith1Response()
        {
            WasThisMiddlwareCalled testMiddleware = new WasThisMiddlwareCalled();
            TestAdapter            adapter        = new TestAdapter()
                                                    .Use(testMiddleware);

            await new TestFlow(adapter, async(context) => { context.Reply("one"); })
            .Send("foo").AssertReply("one")
            .StartTest();

            Assert.IsTrue(testMiddleware.WasContextCreatedCalled, "Context Created was not called");
            Assert.IsTrue(testMiddleware.WasRecevieActivityCalled, "Receive was not called");
            Assert.IsTrue(testMiddleware.WasSendActivityCalled, "Send was not called");
        }
Esempio n. 2
0
        public async Task RunSendPiplineWith0Response()
        {
            WasThisMiddlwareCalled testMiddleware = new WasThisMiddlwareCalled();
            TestAdapter            adapter        = new TestAdapter()
                                                    .Use(testMiddleware);

            await new TestFlow(adapter)
            .Send("foo")
            .StartTest();

            // Test that even though the bot didn't reply with anything, that all 3 pipelines
            // were called. This allows (for example) bot state managment to run even if the
            // bot doesn't return anything.
            Assert.IsTrue(testMiddleware.WasContextCreatedCalled, "Context Created was not called");
            Assert.IsTrue(testMiddleware.WasRecevieActivityCalled, "Receive was not called");
            Assert.IsTrue(testMiddleware.WasSendActivityCalled, "Send was not called");
        }