예제 #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 void ShouldReturnProperNumberOfSection()
 {
     Assert.AreEqual(2, _sectionProvider.GetListOfSectionsToRender(_mocekdContents).Count);
 }