Beispiel #1
0
        public void ResolveFor_BlogContainsSingleFeed_ReturnsFeed()
        {
            // arrange
            var feedTemplateId  = ID.NewID;
            var templateManager = CreateTemplateManager(feedTemplateId);

            var settings = Mock.Of <IWeBlogSettings>(x =>
                                                     x.RssFeedTemplateIds == new[] { feedTemplateId }
                                                     );
            var sut = new FeedResolver(templateManager, settings);

            var blogItemMock = CreateMockBlogItem(true);
            var feedItem     = ItemFactory.CreateItem(templateId: feedTemplateId).Object;

            ItemFactory.AddChildItems(blogItemMock, feedItem);

            // act
            var result = sut.Resolve(blogItemMock.Object);

            // assert
            var feedItems = result.ToList();

            Assert.That(feedItems.Count, Is.EqualTo(1));
            Assert.That(feedItems[0].ID, Is.EqualTo(feedItem.ID));
        }
Beispiel #2
0
        public void ResolveFor_RssDisabled_ReturnsEmpty()
        {
            // arrange
            var feedTemplateId  = ID.NewID;
            var templateManager = CreateTemplateManager(feedTemplateId);

            var settings = Mock.Of <IWeBlogSettings>(x =>
                                                     x.RssFeedTemplateIds == new[] { feedTemplateId }
                                                     );
            var sut = new FeedResolver(templateManager, settings);

            var blogItemMock = CreateMockBlogItem(false);
            var feedItem     = ItemFactory.CreateItem(templateId: feedTemplateId).Object;

            ItemFactory.AddChildItems(blogItemMock, feedItem);

            // act
            var result = sut.Resolve(blogItemMock.Object);

            // assert
            Assert.That(result, Is.Empty);
        }