Ejemplo n.º 1
0
        public IEnumerable <Chunk> Load(ISparkTemplate template, IFubuApplicationFiles files)
        {
            if (template.RelativePath().IsEmpty())
            {
                throw new ArgumentOutOfRangeException("Invalid template path for file " + template.FilePath);
            }

            try
            {
                var viewLoader = _loaders[files.RootPath];
                var chunks     = viewLoader.Load(template.RelativePath());
                if (chunks == null)
                {
                    throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()));
                }

                return(chunks.ToList());
            }
            catch (Exception e)
            {
                if (e.Message.StartsWith("Unable to parse file"))
                {
                    throw;
                }

                throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e);
            }
        }
Ejemplo n.º 2
0
        public IEnumerable<Chunk> Load(ISparkTemplate template, IFubuApplicationFiles files)
        {
            if (template.RelativePath().IsEmpty())
            {
                throw new ArgumentOutOfRangeException("Invalid template path for file " + template.FilePath);
            }

            try
            {
                var viewLoader = _loaders[files.RootPath];
                var chunks = viewLoader.Load(template.RelativePath());
                if (chunks == null)
                {
                    throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()));
                }

                return chunks.ToList();
            }
            catch (Exception e)
            {
                if (e.Message.StartsWith("Unable to parse file")) throw;

                throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e);
            }
        }
Ejemplo n.º 3
0
 protected override void beforeEach()
 {
     Services.Inject <Func <string, IViewFolder> >(root => new InMemoryViewFolder
     {
         { _spark1.RelativePath(), @"<use master=""Fubu""/><div>Hail master Fubu..</div>" },
         { _spark2.RelativePath(), @"<use namespace=""a.b.c""/><use namespace=""x.y.z""/><div>Namespaces</div>" },
         { _spark3.RelativePath(), @"<use master=""""/><viewdata model=""Foo.Bar.Baz""><div>With Model - empty master</div>" }
     });
 }
Ejemplo n.º 4
0
        public IEnumerable <Chunk> Load(ISparkTemplate template)
        {
            try
            {
                var viewLoader = _loaders[template.RootPath];
                var chunks     = viewLoader.Load(template.RelativePath());
                if (chunks == null)
                {
                    throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()));
                }

                return(chunks.ToList());
            }
            catch (Exception e)
            {
                if (e.Message.StartsWith("Unable to parse file"))
                {
                    throw;
                }

                throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e);
            }
        }
Ejemplo n.º 5
0
        protected override void beforeEach()
        {
            _rootRequestCount  = 0;
            _lastRequestedRoot = string.Empty;

            Services.Inject <Func <string, IViewFolder> >(root =>
            {
                _lastRequestedRoot = root;
                _rootRequestCount++;

                return(new InMemoryViewFolder
                {
                    { _template1.RelativePath(), @"<use master=""M1""/><div>path1</div>" },
                    { _template2.RelativePath(), @"<use master=""M2""/><div>path2</div>" }
                });
            });
        }