예제 #1
0
        public void RenderViewSetsPath()
        {
            // arrange
            var templateLocator = A.Fake<IViewLocator>();
            var viewCompiler = A.Fake<IViewCompiler>();
            var viewLocationResult = new ViewLocationResult(@"c:\some\fake\path", null);
            A.CallTo(() => templateLocator.GetTemplateContents("test")).Returns(viewLocationResult);
            var engine = new RazorViewEngine(templateLocator, viewCompiler);

            // act
            var result = engine.RenderView("test", null);

            // assert
            result.Location.ShouldEqual(@"c:\some\fake\path");
        }
예제 #2
0
        public void RenderViewSetsPath()
        {
            // arrange
            var templateLocator    = A.Fake <IViewLocator>();
            var viewCompiler       = A.Fake <IViewCompiler>();
            var viewLocationResult = new ViewLocationResult(@"c:\some\fake\path", null);

            A.CallTo(() => templateLocator.GetTemplateContents("test")).Returns(viewLocationResult);
            var engine = new RazorViewEngine(templateLocator, viewCompiler);

            // act
            var result = engine.RenderView("test", null);

            // assert
            result.Location.ShouldEqual(@"c:\some\fake\path");
        }
예제 #3
0
        public void RenderViewShouldReturnCompiledView()
        {
            // arrange
            var templateLocator = A.Fake<IViewLocator>();
            var viewCompiler = A.Fake<IViewCompiler>();
            var view = A.Fake<IView>();
            var viewLocationResult = new ViewLocationResult(@"c:\some\fake\path", null);
            A.CallTo(() => templateLocator.GetTemplateContents("test")).Returns(viewLocationResult);
            A.CallTo(() => viewCompiler.GetCompiledView(null)).Returns(view);
            var engine = new RazorViewEngine(templateLocator, viewCompiler);
            var stream = new MemoryStream();

            // act
            var result = engine.RenderView("test", stream);

            // assert
            result.View.ShouldBeSameAs(view);
        }
예제 #4
0
        public void RenderViewShouldReturnCompiledView()
        {
            // arrange
            var templateLocator    = A.Fake <IViewLocator>();
            var viewCompiler       = A.Fake <IViewCompiler>();
            var view               = A.Fake <IView>();
            var viewLocationResult = new ViewLocationResult(@"c:\some\fake\path", null);

            A.CallTo(() => templateLocator.GetTemplateContents("test")).Returns(viewLocationResult);
            A.CallTo(() => viewCompiler.GetCompiledView(null)).Returns(view);
            var engine = new RazorViewEngine(templateLocator, viewCompiler);
            var stream = new MemoryStream();

            // act
            var result = engine.RenderView("test", stream);

            // assert
            result.View.ShouldBeSameAs(view);
        }