Exemple #1
0
        public void AddImagesToFeeds_AddsExpectedUrls()
        {
            //Arrange
            string      expected = "https://techbeacon.com/sites/default/files/styles/social/public/field/image/api-management-open-sign.jpg";
            List <Feed> feedList = new List <Feed>();
            Feed        feed1    = new Feed()
            {
                Author      = "test",
                Description = "test",
                ImageUrl    = ""
            };

            Feed feed2 = new Feed()
            {
                Author      = "test1",
                Description = "test1",
                ImageUrl    = "<media:content url=\"https://techbeacon.com/sites/default/files/styles/social/public/field/image/api-management-open-sign.jpg\" " +
                              "medium=\"image\" type=\"image/jpeg\" width=\"1024\" height=\"480\" xmlns:media=\"http://search.yahoo.com/mrss/\" />"
            };

            feedList.Add(feed1);
            feedList.Add(feed2);

            //Act
            var list = rssFeedService.AddImagesToFeedList(feedList);

            //Assert
            Assert.Equal(2, list.Count);
            Assert.Equal(expected, list[1].ImageUrl);
            Assert.NotEqual("", list[0].ImageUrl);
            Assert.StartsWith("https", list[1].ImageUrl);
        }