예제 #1
0
        public async Task ParseInvalidRssFeed_ShouldThrow()
        {
            var feedMock = new SyndicationFeed {
                Title = new TextSyndicationContent("test", TextSyndicationContentKind.Plaintext), BaseUri = new Uri("//testUri.com")
            };

            feedMock.Items = new List <SyndicationItem> {
                MockSyndicationItem("TestEpiId1", "title", "audio/mpeg", "incorrectInput", "http://test.com/test1.mp3", "http://test.com/test1"),
            };
            feedMock.ElementExtensions.Add(new SyndicationElementExtension("showId", "", "testShowId"));
            _rssFeedRepo.Setup(x => x.CallRssFeed("test")).Returns(feedMock);

            var service = new RssFeedService(_rssFeedRepo.Object, _fileRepository.Object);
            var result  = await service.ParseRssFeedAsync("test");

            Assert.Null(result[0].Url);
        }
예제 #2
0
        public async Task ParseValidRssFeed_ShouldReturnValidObject()
        {
            var feedMock = new SyndicationFeed
            {
                Id      = "testShowId",
                Title   = new TextSyndicationContent("test", TextSyndicationContentKind.Plaintext),
                BaseUri = new Uri("//testUri.com"),
                Items   = new List <SyndicationItem>
                {
                    MockSyndicationItem("TestEpiId1", "title", "audio/mpeg", "alternate", "http://test.com/test1.mp3",
                                        "http://test.com/test1"),
                    MockSyndicationItem("TestEpiId2", "title", "audio/mpeg", "alternate", "http://test.com/test2.mp3",
                                        "http://test.com/test2"),
                }
            };

            _rssFeedRepo.Setup(x => x.CallRssFeed("test")).Returns(feedMock);

            var service = new RssFeedService(_rssFeedRepo.Object, _fileRepository.Object);
            var result  = await service.ParseRssFeedAsync("test");

            Assert.NotNull(result[0].CheckSum);
            Assert.NotNull(result[1].CheckSum);
        }