コード例 #1
0
        public TemplateRenderContext(string layoutPath, string mainTemplate)
        {
            Parser = new HamlTreeParser(new HamlFileLexer());

            TemplateDirectory = new DirectoryInfo(mainTemplate).Parent;

            LayoutRoot   = Parser.ParseViewSource(new FileViewSource(new FileInfo(layoutPath)));
            MainTemplate = Parser.ParseViewSource(new FileViewSource(new FileInfo(mainTemplate)));
        }
コード例 #2
0
        public void Walk_SingleLineFile_CallsClassBuilderBuild()
        {
            // Arrange
            const string className = "ClassName";
            Type         baseType  = typeof(Template);
            var          parser    = new HamlTreeParser(new HamlFileLexer());
            var          document  = parser.ParseDocumentSource("Simple content", "");
            var          imports   = new List <string>();

            // Act
            var builder = new Mock <ITemplateClassBuilder>();

            new HamlDocumentWalker(builder.Object).Walk(document, className, baseType, imports);

            // Assert
            builder.Verify(x => x.Build(className, baseType, imports));
        }
コード例 #3
0
 public void Setup()
 {
     _parser = new HamlTreeParser(new HamlFileLexer());
 }