コード例 #1
0
        public void ReadAndProcess_FeedWithThreePages_WithPage1Empty_SearchGuidEmpty_EmptyPageOnFeedExceptionThrown()
        {
            // Arrange
            var guidFeedProcessor = new GuidItemIdBasedAtomFeedProcessor((uri) =>
            {
                if (uri == "http://page0/")
                {
                    return(GetFeedPage0(next_url: "http://page1/"));
                }
                if (uri == "http://page1/")
                {
                    return(GetEmptyPage(prev_url: "http://page0/", next_url: "http://page2/"));
                }
                if (uri == "http://page2/")
                {
                    return(GetFeedPage1(prev_url: "http://page1"));
                }
                return(null);
            });

            // Act
            var actual = new List <SyndicationItem>();

            actual.AddRange(guidFeedProcessor.ReadAndProcess("http://page2/", new Guid("00000000-0000-0000-0000-000000000000"), item => item));
        }
コード例 #2
0
        public void ReadAndProcess_FeedWithMultiplePages_WithSearchGuidAsEmpty_ShouldReadAllItems()
        {
            // Arrange
            var guidFeedProcessor = new GuidItemIdBasedAtomFeedProcessor((uri) =>
            {
                if (uri == "http://page0/")
                {
                    return(GetFeedPage0(next_url: "http://page1"));
                }
                if (uri == "http://page1/")
                {
                    return(GetFeedPage1(prev_url: "http://page0"));
                }
                return(null);
            });

            // Act
            var actual = new List <SyndicationItem>();

            actual.AddRange(guidFeedProcessor.ReadAndProcess("http://page1/", new Guid("00000000-0000-0000-0000-000000000000"), item => item));

            // Assert
            Assert.AreEqual(4, actual.Count);
            Assert.AreEqual("uuid:00000000-0000-0000-0000-000000000001", actual[0].Id);
            Assert.AreEqual("uuid:00000000-0000-0000-0000-000000000002", actual[1].Id);
            Assert.AreEqual("uuid:00000000-0000-0000-0000-000000000003", actual[2].Id);
            Assert.AreEqual("uuid:00000000-0000-0000-0000-000000000004", actual[3].Id);
            Assert.AreEqual("Item 1", actual[0].Title.Text);
            Assert.AreEqual("Item 2", actual[1].Title.Text);
            Assert.AreEqual("Item 3", actual[2].Title.Text);
            Assert.AreEqual("Item 4", actual[3].Title.Text);
        }
コード例 #3
0
        public void ReadAndProcess_FeedWithNoItems_SearchGuidNonEmpty_GuidBookmarkNotMatchedExceptionThrown()
        {
            // Arrange
            var guidFeedProcessor = new GuidItemIdBasedAtomFeedProcessor((uri) => GetEmptyPage());

            // Act
            guidFeedProcessor.ReadAndProcess("test", new Guid("00000000-0000-0000-0000-000000000005"), item => item);
        }
コード例 #4
0
        public void ReadAndProcess_FeedWithOnePage_NoMatchesFound_GuidBookmarkNotMatchedExceptionThrown()
        {
            // Arrange
            var guidFeedProcessor = new GuidItemIdBasedAtomFeedProcessor((uri) => GetFeedPage0());

            // Act
            guidFeedProcessor.ReadAndProcess("test", new Guid("00000000-0000-0000-0000-000000000005"), item => item);
        }
コード例 #5
0
        public void ReadAndProcess_FeedWithNoItems_SearchGuidEmpty_NoExceptionThrown()
        {
            // Arrange
            var guidFeedProcessor = new GuidItemIdBasedAtomFeedProcessor((uri) => GetEmptyPage());

            // Act
            var actual = new List <SyndicationItem>();

            // This shouldn't throw any exception
            guidFeedProcessor.ReadAndProcess("test", new Guid("00000000-0000-0000-0000-000000000000"), item => item);
        }
コード例 #6
0
        public void ReadAndProcess_FeedWithOnePage_MatchingGuidFound_ElementsAfterMatchingGuidRead()
        {
            // Arrange
            var guidFeedProcessor = new GuidItemIdBasedAtomFeedProcessor((uri) => GetFeedPage0());

            // Act
            var actual = new List <SyndicationItem>();

            actual.AddRange(guidFeedProcessor.ReadAndProcess("test", new Guid("00000000-0000-0000-0000-000000000001"), item => item));

            // Assert
            Assert.AreEqual(1, actual.Count);
            Assert.AreEqual("uuid:00000000-0000-0000-0000-000000000002", actual[0].Id);
            Assert.AreEqual("Item 2", actual[0].Title.Text);
        }
コード例 #7
0
        public void ReadAndProcess_FeedWithEmptyPage0_SearchGuidNotEmpty_GuidBookmarkNotMatchedExceptionThrown()
        {
            // Arrange
            var guidFeedProcessor = new GuidItemIdBasedAtomFeedProcessor((uri) =>
            {
                if (uri == "http://page0/")
                {
                    return(GetEmptyPage(next_url: "http://page1"));
                }
                if (uri == "http://page1/")
                {
                    return(GetFeedPage1(prev_url: "http://page0"));
                }
                return(null);
            });

            // Act
            guidFeedProcessor.ReadAndProcess("http://page1/", new Guid("00000000-0000-0000-0000-000000000005"), item => item);
        }