示例#1
0
        public async Task GetRandomLink(IDialogContext context, LuisResult result)
        {
            var linkSource = new BoredPandaLinkSource();
            await context.PostAsync(linkSource.GetRandomLink());

            context.Wait(MessageReceived);
        }
        public void GetRandomLinkReturnsLinkThatStartsWithHttp()
        {
            //Arrange
            var linkSource = new BoredPandaLinkSource();
            //Act
            var result = linkSource.GetRandomLink();

            //Arrange
            Assert.That(result, Does.StartWith("http://"));
        }
        public void GetRandomLinkReturnsNotNull()
        {
            //Arrange
            var linkSource = new BoredPandaLinkSource();
            //Act
            var result = linkSource.GetRandomLink();

            //Arrange
            Assert.That(result, Is.Not.Null);
        }
示例#4
0
        private async Task MessageActivity(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            if (activity.Text.Contains("hej"))
            {
                await context.PostAsync("co znowu...");
            }
            else
            {
                var linkSource = new BoredPandaLinkSource();
                await context.PostAsync(linkSource.GetRandomLink());
            }

            context.Wait(MessageActivity);
        }