Exemple #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));
        }
Exemple #2
0
        public void ResolveFor_BlogItemIsNull_ReturnsEmpty()
        {
            // arrange
            var templateManager = Mock.Of <BaseTemplateManager>();
            var settings        = Mock.Of <IWeBlogSettings>();
            var sut             = new FeedResolver(templateManager, settings);

            // act
            var result = sut.Resolve(null);

            // assert
            Assert.That(result, Is.Empty);
        }
Exemple #3
0
        public void ResolveFor_BlogContainsNoFeeds_ReturnsEmpty()
        {
            // arrange
            var templateManager = Mock.Of <BaseTemplateManager>();
            var settings        = Mock.Of <IWeBlogSettings>();
            var sut             = new FeedResolver(templateManager, settings);

            var blogItemMock = CreateMockBlogItem(true);

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

            // assert
            Assert.That(result, Is.Empty);
        }
Exemple #4
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);
        }
Exemple #5
0
 public override void Initialize(Rendering rendering)
 {
     base.Initialize(rendering);
     FeedItems = FeedResolver.Resolve(CurrentBlog);
 }