Пример #1
0
        public void TestGetFeed()
        {
            var catalog = CreateTestCatalog();

            Assert.AreEqual(FeedTest.CreateTestFeed(), catalog.GetFeed(FeedTest.Test1Uri));
            Assert.AreEqual(FeedTest.CreateTestFeed(), catalog[FeedTest.Test1Uri]);

            Assert.IsNull(catalog.GetFeed(new FeedUri("http://invalid/")));
            // ReSharper disable once UnusedVariable
            Assert.Throws <KeyNotFoundException>(() => { var dummy = catalog[new FeedUri("http://invalid/")]; });
        }
Пример #2
0
        public void TestGetFeed()
        {
            var catalog = CreateTestCatalog();

            catalog.GetFeed(FeedTest.Test1Uri).Should().Be(FeedTest.CreateTestFeed());
            catalog[FeedTest.Test1Uri].Should().Be(FeedTest.CreateTestFeed());

            catalog.GetFeed(new FeedUri("http://invalid/")).Should().BeNull();
            // ReSharper disable once UnusedVariable
            catalog.Invoking(x => { var _ = x[new FeedUri("http://invalid/")]; }).ShouldThrow <KeyNotFoundException>();
        }
Пример #3
0
 /// <summary>
 /// Creates a fictive test <see cref="Catalog"/>.
 /// </summary>
 public static Catalog CreateTestCatalog()
 {
     return(new Catalog {
         Feeds = { FeedTest.CreateTestFeed() }
     });
 }