public MasterAttacher(IParsingRegistrations registrations, ISharedTemplateLocator templateLocator) { _registrations = registrations; _templateLocator = templateLocator; MasterName = FallbackMaster; }
protected override void beforeEach() { var repo = new MockRepository(); _bindings = new List <ITemplate>(); _bindings.AddRange(Enumerable.Range(1, 5).Select(x => repo.DynamicMock <ITemplate>())); _logger = MockFor <ISparkLogger>(); _sharedTemplateLocator = MockFor <ISharedTemplateLocator>(); _template = MockFor <ITemplate>(); _template.Stub(x => x.Descriptor).PropertyBehavior(); _template.Stub(x => x.FilePath).Return("Fubu.spark"); _template.Stub(x => x.RootPath).Return("/App/Views"); _template.Stub(x => x.Origin).Return("Host"); _template.Descriptor = new ViewDescriptor(_template); ClassUnderTest.BindingsName = "bindings"; _request = new BindRequest { TemplateRegistry = new TemplateRegistry(new[] { _template }.Union(_bindings)), Target = _template, ViewModelType = typeof(ProductModel).FullName, Logger = _logger, }; _sharedTemplateLocator .Expect(x => x.LocateBindings(ClassUnderTest.BindingsName, _template, _request.TemplateRegistry)) .Return(_bindings); _logger .Expect(x => x.Log(Arg.Is(_template), Arg <string> .Is.Anything, Arg <string> .Is.Anything)) .Repeat.Times(_bindings.Count); }
public ExtendedTester() { var testRoot = Path.Combine(Directory.GetCurrentDirectory(), "Templates"); var pathApp = Path.Combine(testRoot, "App"); var pathPackage1 = Path.Combine(pathApp, "fubu-packages", "Package1", "WebContent"); var pathPackage2 = Path.Combine(testRoot, "Package2"); var allTemplates = new TemplateRegistry <IRazorTemplate>(); var razorSettings = new RazorEngineSettings(); var razorSet = razorSettings.Search; new ContentFolder(TemplateConstants.HostOrigin, pathApp).FindFiles(razorSet) .Union(new ContentFolder("Package1", pathPackage1).FindFiles(razorSet) .Union(new ContentFolder("Package2", pathPackage2).FindFiles(razorSet))) .Each(x => { if (x.Provenance == TemplateConstants.HostOrigin && x.Path.StartsWith(pathPackage1)) { return; } allTemplates.Register(new Template(x.Path, x.ProvenancePath, x.Provenance)); }); var viewPathPolicy = new ViewPathPolicy <IRazorTemplate>(); allTemplates.Each(x => { viewPathPolicy.Apply(x); x.Descriptor = new ViewDescriptor <IRazorTemplate>(x); }); var commonNamespaces = new CommonViewNamespaces(); commonNamespaces.AddForType <string>(); _templateFactory = new TemplateFactoryCache(commonNamespaces, razorSettings, new TemplateCompiler(), new RazorTemplateGenerator()); _pak1TemplateRegistry = new TemplateRegistry <IRazorTemplate>(allTemplates.ByOrigin(Package1)); _pak2TemplateRegistry = new TemplateRegistry <IRazorTemplate>(allTemplates.ByOrigin(Package2)); _appTemplateRegistry = new TemplateRegistry <IRazorTemplate>(allTemplates.FromHost()); _serviceLocator = MockRepository.GenerateMock <IServiceLocator>(); var sharingGraph = new SharingGraph(); sharingGraph.Dependency("Package1", ContentFolder.Application); sharingGraph.Dependency("Package2", ContentFolder.Application); var templateDirectory = new TemplateDirectoryProvider <IRazorTemplate>(new SharedPathBuilder(), allTemplates, sharingGraph); _sharedTemplateLocator = new SharedTemplateLocator <IRazorTemplate>(templateDirectory, allTemplates, new RazorTemplateSelector()); var partialRenderer = new PartialRenderer(_sharedTemplateLocator, _templateFactory); _serviceLocator.Expect(x => x.GetInstance(Arg.Is(typeof(IPartialRenderer)))).Return(partialRenderer); _serviceLocator.Expect(x => x.GetInstance(typeof(IOutputWriter))).Return(MockRepository.GenerateMock <IOutputWriter>()); }
public ExtendedTester() { var testRoot = Path.Combine(Directory.GetCurrentDirectory(), "Templates"); var pathApp = Path.Combine(testRoot, "App"); var pathPackage1 = Path.Combine(pathApp, "fubu-packages", "Package1", "WebContent"); var pathPackage2 = Path.Combine(testRoot, "Package2"); var allTemplates = new TemplateRegistry<IRazorTemplate>(); var razorSettings = new RazorEngineSettings(); var razorSet = razorSettings.Search; new ContentFolder(TemplateConstants.HostOrigin, pathApp).FindFiles(razorSet) .Union(new ContentFolder("Package1", pathPackage1).FindFiles(razorSet) .Union(new ContentFolder("Package2", pathPackage2).FindFiles(razorSet))) .Each(x => { if (x.Provenance == TemplateConstants.HostOrigin && x.Path.StartsWith(pathPackage1)) return; allTemplates.Register(new Template(x.Path, x.ProvenancePath, x.Provenance)); }); var viewPathPolicy = new ViewPathPolicy<IRazorTemplate>(); allTemplates.Each(x => { viewPathPolicy.Apply(x); x.Descriptor = new ViewDescriptor<IRazorTemplate>(x); }); var commonNamespaces = new CommonViewNamespaces(); commonNamespaces.AddForType<string>(); _templateFactory = new TemplateFactoryCache(commonNamespaces, razorSettings, new TemplateCompiler(), new RazorTemplateGenerator()); _pak1TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package1)); _pak2TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package2)); _appTemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.FromHost()); _serviceLocator = MockRepository.GenerateMock<IServiceLocator>(); var sharingGraph = new SharingGraph(); sharingGraph.Dependency("Package1", ContentFolder.Application); sharingGraph.Dependency("Package2", ContentFolder.Application); var templateDirectory = new TemplateDirectoryProvider<IRazorTemplate>(new SharedPathBuilder(), allTemplates, sharingGraph); _sharedTemplateLocator = new SharedTemplateLocator<IRazorTemplate>(templateDirectory, allTemplates, new RazorTemplateSelector()); var partialRenderer = new PartialRenderer(_sharedTemplateLocator, _templateFactory); _serviceLocator.Expect(x => x.GetInstance(Arg.Is(typeof (IPartialRenderer)))).Return(partialRenderer); _serviceLocator.Expect(x => x.GetInstance(typeof (IOutputWriter))).Return(MockRepository.GenerateMock<IOutputWriter>()); }
public ExtendedTester() { var testRoot = Path.Combine(Directory.GetCurrentDirectory(), "Templates"); var pathApp = Path.Combine(testRoot, "App"); var pathPackage1 = Path.Combine(pathApp, "fubu-packages", "Package1", "WebContent"); var pathPackage2 = Path.Combine(testRoot, "Package2"); var allTemplates = new TemplateRegistry <IRazorTemplate>(); var razorSet = new RazorEngineSettings().Search; new ContentFolder(TemplateConstants.HostOrigin, pathApp).FindFiles(razorSet) .Union(new ContentFolder("Package1", pathPackage1).FindFiles(razorSet) .Union(new ContentFolder("Package2", pathPackage2).FindFiles(razorSet))) .Each(x => { if (x.Provenance == TemplateConstants.HostOrigin && x.Path.StartsWith(pathPackage1)) { return; } allTemplates.Register(new Template(x.Path, x.ProvenancePath, x.Provenance)); }); var viewPathPolicy = new ViewPathPolicy <IRazorTemplate>(); allTemplates.Each(viewPathPolicy.Apply); var config = new TemplateServiceConfiguration { BaseTemplateType = typeof(FubuRazorView) }; _templateService = new FubuTemplateService(allTemplates, new TemplateService(config), new FileSystem()); _pak1TemplateRegistry = new TemplateRegistry <IRazorTemplate>(allTemplates.ByOrigin(Package1)); _pak2TemplateRegistry = new TemplateRegistry <IRazorTemplate>(allTemplates.ByOrigin(Package2)); _appTemplateRegistry = new TemplateRegistry <IRazorTemplate>(allTemplates.FromHost()); _serviceLocator = MockRepository.GenerateMock <IServiceLocator>(); var sharingGraph = new SharingGraph(); sharingGraph.Dependency("Package1", ContentFolder.Application); sharingGraph.Dependency("Package2", ContentFolder.Application); var templateDirectory = new TemplateDirectoryProvider <IRazorTemplate>(new SharedPathBuilder(), allTemplates, sharingGraph); _sharedTemplateLocator = new SharedTemplateLocator <IRazorTemplate>(templateDirectory, allTemplates, new RazorTemplateSelector()); }
public ExtendedTester() { var testRoot = Path.Combine(Directory.GetCurrentDirectory(), "Templates"); var pathApp = Path.Combine(testRoot, "App"); var pathPackage1 = Path.Combine(pathApp, "fubu-packages", "Package1", "WebContent"); var pathPackage2 = Path.Combine(testRoot, "Package2"); var allTemplates = new TemplateRegistry<IRazorTemplate>(); var razorSet = new RazorEngineSettings().Search; new ContentFolder(TemplateConstants.HostOrigin, pathApp).FindFiles(razorSet) .Union(new ContentFolder("Package1", pathPackage1).FindFiles(razorSet) .Union(new ContentFolder("Package2", pathPackage2).FindFiles(razorSet))) .Each(x => { if (x.Provenance == TemplateConstants.HostOrigin && x.Path.StartsWith(pathPackage1)) return; allTemplates.Register(new Template(x.Path, x.ProvenancePath, x.Provenance)); }); var viewPathPolicy = new ViewPathPolicy<IRazorTemplate>(); allTemplates.Each(viewPathPolicy.Apply); var config = new TemplateServiceConfiguration { BaseTemplateType = typeof(FubuRazorView) }; _templateService = new FubuTemplateService(allTemplates, new TemplateService(config), new FileSystem()); _pak1TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package1)); _pak2TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package2)); _appTemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.FromHost()); _serviceLocator = MockRepository.GenerateMock<IServiceLocator>(); var sharingGraph = new SharingGraph(); sharingGraph.Dependency("Package1", ContentFolder.Application); sharingGraph.Dependency("Package2", ContentFolder.Application); var templateDirectory = new TemplateDirectoryProvider<IRazorTemplate>(new SharedPathBuilder(), allTemplates, sharingGraph); _sharedTemplateLocator = new SharedTemplateLocator<IRazorTemplate>(templateDirectory, allTemplates, new RazorTemplateSelector()); }
public PartialRenderer(ISharedTemplateLocator <IRazorTemplate> sharedTemplateLocator, ITemplateFactory templateFactory) { _sharedTemplateLocator = sharedTemplateLocator; _templateFactory = templateFactory; }
public MasterAttacher(IParsingRegistrations <T> parsing, ISharedTemplateLocator <T> sharedTemplateLocator) { _parsing = parsing; _sharedTemplateLocator = sharedTemplateLocator; MasterName = FallbackMaster; }
public MasterPageBinder(ISharedTemplateLocator sharedTemplateLocator) { _sharedTemplateLocator = sharedTemplateLocator; MasterName = FallbackMaster; }
public ReachableBindingsBinder(ISharedTemplateLocator sharedTemplateLocator) { _sharedTemplateLocator = sharedTemplateLocator; BindingsName = FallbackBindingsName; }
public MasterAttacher(IParsingRegistrations registrations, ISharedTemplateLocator templateLocator) { _registrations = registrations; _templateLocator = templateLocator; MasterName = FallbackMaster; }
public BindingsAttacher(ISharedTemplateLocator templateLocator) { _templateLocator = templateLocator; BindingsName = FallbackBindingsName; }
public ReachableBindingsBinder(ISharedTemplateLocator sharedTemplateLocator) { _sharedTemplateLocator = sharedTemplateLocator; BindingsName = FallbackBindingsName; }
public MasterPageBinder(ISharedTemplateLocator sharedTemplateLocator) { _sharedTemplateLocator = sharedTemplateLocator; MasterName = FallbackMaster; }
public PartialRendering(ISharedTemplateLocator <IRazorTemplate> locator, IFubuTemplateService templateService) { _locator = locator; _templateService = templateService; }
public BindingsAttacher(ISharedTemplateLocator templateLocator) { _templateLocator = templateLocator; BindingsName = FallbackBindingsName; }
public PartialRenderer(ISharedTemplateLocator<IRazorTemplate> sharedTemplateLocator, ITemplateFactory templateFactory) { _sharedTemplateLocator = sharedTemplateLocator; _templateFactory = templateFactory; }
public ExtendedTester() { var testRoot = Path.Combine(Directory.GetCurrentDirectory(), "Templates"); var pathApp = Path.Combine(testRoot, "App"); var pathPackage1 = Path.Combine(pathApp, "fubu-packages", "Package1", "WebContent"); var pathPackage2 = Path.Combine(testRoot, "Package2"); var packages = new List<IPackageInfo>(); var pack1 = new PackageInfo(Package1); var pack2 = new PackageInfo(Package2); pack1.RegisterFolder(BottleFiles.WebContentFolder, pathPackage1); pack2.RegisterFolder(BottleFiles.WebContentFolder, pathPackage2); packages.Add(pack1); packages.Add(pack2); var scanner = new TemplateFinder<Template>(new FileScanner(), packages) {HostPath = pathApp}; new DefaultRazorTemplateFinderConventions().Configure(scanner); var allTemplates = new TemplateRegistry<IRazorTemplate>(); allTemplates.AddRange(scanner.FindInPackages()); allTemplates.AddRange(scanner.FindInHost()); var viewPathPolicy = new ViewPathPolicy<IRazorTemplate>(); allTemplates.Each(viewPathPolicy.Apply); var config = new TemplateServiceConfiguration {BaseTemplateType = typeof (FubuRazorView)}; _templateService = new FubuTemplateService(allTemplates, new TemplateService(config), new FileSystem()); _pak1TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package1)); _pak2TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package2)); _appTemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.FromHost()); _serviceLocator = MockRepository.GenerateMock<IServiceLocator>(); var sharingGraph = new SharingGraph(); sharingGraph.Dependency("Package1", "Host"); sharingGraph.Dependency("Package2", "Host"); var templateDirectory = new TemplateDirectoryProvider<IRazorTemplate>(new SharedPathBuilder(), allTemplates, sharingGraph); _sharedTemplateLocator = new SharedTemplateLocator<IRazorTemplate>(templateDirectory, allTemplates, new RazorTemplateSelector()); }