예제 #1
0
        private string GetViewOutput(string viewName, string masterName)
        {
            BrailBase view = _viewEngine.Process(viewName, masterName);

            _viewContext = new ViewContext(controllerContext, view, new ViewDataDictionary(), new TempDataDictionary(), new StringWriter());
            view.Render(_viewContext, _httpContext.Response.Output);
            return(_httpContext.Response.Output.ToString());
        }
예제 #2
0
        public void Should_Use_Custom_Base_Class()
        {
            _mocks.ReplayAll();
            _viewEngine.Options.AssembliesToReference.Add(GetType().Assembly);
            _viewEngine.Options.BaseType = typeof(TestBrailBase).FullName;
            BrailBase view = _viewEngine.Process("view", null);

            Assert.IsInstanceOf <TestBrailBase>(view);
        }
예제 #3
0
        public void Layout_And_View_Should_Have_ViewContext()
        {
            _mocks.ReplayAll();
            BrailBase view = _viewEngine.Process("view", "/Master");

            _viewContext = new ViewContext(controllerContext, view, new ViewDataDictionary(), new TempDataDictionary(), new StringWriter());
            view.Render(_viewContext, _httpContext.Response.Output);
            Assert.IsNotNull(view.ViewContext);
            Assert.AreEqual(view.ViewContext, view.Layout.ViewContext);
        }
예제 #4
0
 public void SetUp()
 {
     _mocks      = new MockRepository();
     _viewEngine = _mocks.DynamicMock <BooViewEngine>();
     _view       = _mocks.StrictMock <BrailBase>(_viewEngine);
 }