public void RenderExceptionTests() { var parsedViewMock = new Mock<IParsedView>(); var view = new YateView(parsedViewMock.Object); Assert.Throws<ArgumentNullException>(() => view.Render(null, null)); Assert.Throws<ArgumentNullException>(() => view.Render(new Mock<ViewContext>().Object, null)); Assert.Throws<ArgumentNullException>(() => view.Render(null, new Mock<TextWriter>().Object)); }
public void RenderCallsParsedViewRenderTest() { var parsedViewMock = new Mock<IParsedView>(); var view = new YateView(parsedViewMock.Object); var data = new Mock<IYateDataContext>(); var context = new Mock<ViewContext>(); context.Setup(c => c.ViewData) .Returns(new ViewDataDictionary()); view.Render(context.Object, new Mock<TextWriter>().Object); parsedViewMock.Verify(pv => pv.WriteToTextWriter(It.IsAny<TextWriter>(), It.IsAny<IYateDataContext>()), Times.Once()); }