Exemple #1
0
        protected override void beforeEach()
        {
            const string viewPath    = "/_Package1_/Handlers/Models/SerieSL.spark";
            var          appRoot     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates");
            var          packageRoot = Path.Combine(appRoot, "App", "fubu-packages", "Package1", "WebContent");

            var binding1       = new Template(Path.Combine(packageRoot, "Handlers", "Shared", "bindings.xml"), packageRoot, "Package1");
            var binding2       = new Template(Path.Combine(appRoot, "Shared", "bindings.xml"), appRoot, TemplateConstants.HostOrigin);
            var viewPathPolicy = new ViewPathPolicy <ITemplate>();

            viewPathPolicy.Apply(binding1);
            viewPathPolicy.Apply(binding2);

            _viewFolder = MockFor <IViewFolder>();
            _viewFolder.Expect(x => x.GetViewSource(binding1.ViewPath)).Return(new FileSystemViewFile(binding1.FilePath));
            _viewFolder.Expect(x => x.GetViewSource(binding2.ViewPath)).Return(new FileSystemViewFile(binding2.FilePath));

            _request = new BindingRequest(_viewFolder)
            {
                ViewPath = viewPath
            };

            _templateRegistry = MockFor <ISparkTemplateRegistry>();
            _templateRegistry.Expect(x => x.BindingsForView(viewPath)).Return(new[] { binding1, binding2 });
        }
Exemple #2
0
        IViewFile ExpectGetChunks(string path, params Chunk[] chunks)
        {
            var source = MockRepository.GenerateMock <IViewFile>();

            viewFolder.Expect(x => x.GetViewSource(path)).Return(source);
            source.Expect(x => x.LastModified).Return(0);
            syntaxProvider.Expect(x => x.GetChunks(null, null)).IgnoreArguments().Return(chunks);

            return(source);
        }