private IFubuRazorView getPartialView(IFubuRazorView view, string name) { var template = _sharedTemplateLocator.LocatePartial(name, view.OriginTemplate); var partialView = _templateFactory.GetView(template.Descriptor.As <ViewDescriptor <IRazorTemplate> >()); return(partialView); }
public HtmlString Render(IFubuRazorView view, string name) { var partialView = getPartialView(view, name); partialView.Execute(); return(new HtmlString(partialView.Result.ToString())); }
protected override void beforeEach() { var source = "<h1>hi</h1>"; var viewId = Guid.NewGuid(); _service = MockFor <IViewModifierService <IFubuRazorView> >(); _templateService = MockFor <ITemplateService>(); var fileSystem = MockFor <IFileSystem>(); fileSystem.Expect(x => x.ReadStringFromFile(null)).Return(source); var template = MockFor <IRazorTemplate>(); template.Expect(x => x.GeneratedViewId).Return(viewId); var descriptor = new ViewDescriptor <IRazorTemplate>(template); Services.Inject(descriptor); Services.Inject <IFubuTemplateService>(new FubuTemplateService(new TemplateRegistry <IRazorTemplate>(), _templateService, fileSystem)); _entryView = MockRepository.GenerateMock <StubView>(); _serviceView = MockRepository.GenerateMock <IFubuRazorView>(); _templateService.Expect(x => x.HasTemplate(Arg.Is(viewId.ToString()))).Return(false); _templateService.Expect(x => x.GetTemplate(Arg.Is(source), Arg.Is(viewId.ToString()))).Return(_entryView); _service.Expect(x => x.Modify(_entryView)).Return(_serviceView); }
protected override void beforeEach() { var source = "<h1>hi</h1>"; var viewId = Guid.NewGuid(); _service = MockFor <IViewModifierService <IFubuRazorView> >(); _templateFactory = MockFor <ITemplateFactory>(); var fileSystem = MockFor <IFileSystem>(); fileSystem.Expect(x => x.ReadStringFromFile(null)).Return(source); var template = MockFor <IRazorTemplate>(); template.Expect(x => x.GeneratedViewId).Return(viewId); var descriptor = new ViewDescriptor <IRazorTemplate>(template); Services.Inject(descriptor); Services.Inject(_templateFactory); _entryView = MockRepository.GenerateMock <StubView>(); _serviceView = MockRepository.GenerateMock <IFubuRazorView>(); _templateFactory.Expect(x => x.GetView(Arg.Is(descriptor))).Return(_entryView); _service.Expect(x => x.Modify(_entryView)).Return(_serviceView); }
public void UseLayout(IFubuRazorView layout) { Layout = layout; if (_Layout == null) { _Layout = Layout.GetType().FullName; } }
public HtmlString Render(IFubuRazorView view, string name, object model) { var partialView = getPartialView(view, name); dynamic fubuPage = partialView; dynamic dynamicModel = model; fubuPage.Model = dynamicModel; partialView.Execute(); return new HtmlString(partialView.Result.ToString()); }
public HtmlString Render(IFubuRazorView view, string name, object model) { var partialView = getPartialView(view, name); dynamic fubuPage = partialView; dynamic dynamicModel = model; fubuPage.Model = dynamicModel; partialView.Execute(); return(new HtmlString(partialView.Result.ToString())); }
public static IFubuRazorView Modify(this IFubuRazorView view, Action <IFubuRazorView> modify) { modify(view); return(view); }
public static HtmlString RenderPartial(this IFubuRazorView view, string name) { return(view.Get <IPartialRenderer>().Render(view, name)); }
private IFubuRazorView getPartialView(IFubuRazorView view, string name) { var template = _sharedTemplateLocator.LocatePartial(name, view.OriginTemplate); var partialView = _templateFactory.GetView(template.Descriptor.As<ViewDescriptor<IRazorTemplate>>()); return partialView; }
public HtmlString Render(IFubuRazorView view, string name) { var partialView = getPartialView(view, name); partialView.Execute(); return new HtmlString(partialView.Result.ToString()); }
void IFubuRazorView.ExecuteLayout(IFubuRazorView child) { _child = child; _renderAction(); }
void IFubuRazorView.UseLayout(IFubuRazorView layout) { LayoutView = layout; _renderAction = RenderWithLayout; _result = () => layout.Result.ToString(); }
private IFubuRazorView getPartialView(IFubuRazorView view, string name) { var template = _views.FindPartial(view.OriginTemplate, name); return(template.GetPartialView() as IFubuRazorView); }
private IFubuRazorView getPartialView(IFubuRazorView view, string name) { var template = _views.FindPartial(view.OriginTemplate, name); return template.GetPartialView() as IFubuRazorView; }
protected override void beforeEach() { _view = MockFor <IFubuRazorView>(); }