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