示例#1
0
        public void ShouldRenderUsingFirstBuilderWhenManyApplyToOneAlias()
        {
            _buildersList.Insert(0, new FakeBuilder());
            var builderFactory   = new BuildersFactory(_buildersList);
            var sectionProviders = new SectionsProvider(builderFactory);

            var sections = sectionProviders.GetListOfSectionsToRender(_mocekdContents);

            Assert.IsTrue(sections.Any(x => x.ViewModel is FakeViewModel));
            Assert.IsFalse(sections.Any(x => x.ViewModel is HeaderViewModel));
        }
示例#2
0
        public void ShouldContainErrorViewModelInsteadProperWhenExceptionHappen()
        {
            var builders = _buildersList.Where(x => !x.DeosApply(SectionDocumentTypes.Header)).ToList();

            builders.Add(new FakeBuilderWhichReturnsException());
            var builderFactory   = new BuildersFactory(builders);
            var sectionProviders = new SectionsProvider(builderFactory);
            var sections         = sectionProviders.GetListOfSectionsToRender(_mocekdContents);

            Assert.IsTrue(sections.Any(x => x.ViewModel is SectionErrorViewModel));

            var model          = sections.First(x => x.ViewModel is SectionErrorViewModel).ViewModel;
            var errorViewModel = (SectionErrorViewModel)model;

            Assert.AreEqual("message of exception", errorViewModel.ErrorMsg);
        }
示例#3
0
 public static void ClearAllRawData()
 {
     try
     {
         TitlesProvider.ClearRawTable();
         FilteredProvider.ClearRawTable();
         SectionsProvider.ClearRawTable();
         SeasonsProvider.ClearRawTable();
         EpisodesProvider.ClearRawTable();
         TracksProvider.ClearRawTable();
         AlbumsProvider.ClearRawTable();
     }
     catch (Exception ex)
     {
         LoggingHelpers.RecordException(ex.Message, @"ClearAllRawDataError");
     }
 }
示例#4
0
        public void SetUp()
        {
            _buildersList = new List <ISectionBuilder> {
                new HeaderBuilder(new NodeHelper()), new FooterBuilder(null)
            };
            var builderFactory = new BuildersFactory(_buildersList);

            _sectionProvider = new SectionsProvider(builderFactory);

            var mockContentHeader = new PublishedContentMockingHelper();

            mockContentHeader.SetAlias(SectionDocumentTypes.Header);

            var mockContentFooter = new PublishedContentMockingHelper();

            mockContentFooter.SetAlias(SectionDocumentTypes.Footer);

            _mocekdContents = new List <IPublishedContent> {
                mockContentHeader.ContentMock, mockContentFooter.ContentMock
            };
        }