public void GetBingImageUrlTest()
        {
            BingImageService    service = new BingImageService();
            DailyChallengeImage image   = service.GetBingImageUrl(1);

            Assert.IsTrue(!string.IsNullOrEmpty(image.ImageText) && !string.IsNullOrEmpty(image.ImageRegion));
        }
Ejemplo n.º 2
0
        private async Task <Attachment> GetBingImageChoiceAttachment(int imageIndex)
        {
            BingImageService    imageService = new BingImageService();
            DailyChallengeImage image        = imageService.GetBingImageUrl(imageIndex);
            await tableService.SaveDailyChallengeImage(image);

            var heroCard = new HeroCard
            {
                Title    = "Today's Daily Challenge",
                Subtitle = image.ImageRegion,
                Text     = "Click to choose the image for today or try another image.",
                Images   = new List <CardImage> {
                    new CardImage(image.Url)
                },
                Buttons = new List <CardAction> {
                    new CardAction(ActionTypes.ImBack, "Choose image", value: "Choose image"),
                    new CardAction(ActionTypes.ImBack, "Try another image", value: "Try another image"),
                    new CardAction(ActionTypes.ImBack, "Switch to Google", value: "Switch to Google")
                }
            };

            return(heroCard.ToAttachment());
        }