Exemplo n.º 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, FubuSparkConstants.HostOrigin);
            var viewPathPolicy = new ViewPathPolicy();

            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 <ITemplateRegistry>();
            _templateRegistry.Expect(x => x.BindingsForView(viewPath)).Return(new[] { binding1, binding2 });
        }