Exemple #1
0
        public void CanReadTemplateCompilerFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.AreEqual("CSharp3", section.TemplateCompiler);
        }
Exemple #2
0
        public void CanReadViewsNamespacesSectionFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.AreEqual(1, section.Namespaces.Count);
            Assert.AreEqual("System.Collections", section.Namespaces[0].Name);
        }
Exemple #3
0
        public void CanReadViewsAssembliesSectionFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.AreEqual(1, section.Assemblies.Count);
            Assert.AreEqual("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089", section.Assemblies[0].Name);
        }
Exemple #4
0
        public void CanReadEscapeHtmlFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.IsTrue(section.EncodeHtml.HasValue);
            Assert.IsFalse(section.EncodeHtml.Value);
        }
Exemple #5
0
        public void CanReadOutputDebugFilesSettingFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.IsTrue(section.OutputDebugFiles.HasValue);
            Assert.AreEqual(true, section.OutputDebugFiles.Value);
        }
Exemple #6
0
        public void CanReadIndentSizeSettingFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.IsTrue(section.IndentSize.HasValue);
            Assert.AreEqual(2, section.IndentSize.Value);
        }
Exemple #7
0
        public void CanReadUseTabsSettingFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.IsTrue(section.UseTabs.HasValue);
            Assert.IsFalse(section.UseTabs.Value);
        }
Exemple #8
0
        public void CanReadAutoRecompileSettingFromAppSettings()
        {
            var section = NHamlConfigurationSection.GetSection();

            Assert.IsNotNull(section);
            Assert.IsTrue(section.AutoRecompile.HasValue);
            Assert.IsTrue(section.AutoRecompile.Value);
        }
Exemple #9
0
        public TemplateEngine(TemplateOptions options)
        {
            Invariant.ArgumentNotNull(options, "options");

            Options = options;

            _compiledTemplateCache = new Dictionary <string, CompiledTemplate>();

            NHamlConfigurationSection.UpdateTemplateOptions(Options);
            Options.TemplateBaseTypeChanged += (sender, args) => ClearCompiledTemplatesCache();
            Options.TemplateCompilerChanged += (sender, args) => ClearCompiledTemplatesCache();
        }
Exemple #10
0
        public void GetConfiguration_ConfigWithReferencesAndImports_ImportListContainsCorrectElement()
        {
            var config = NHamlConfigurationSection.GetConfiguration("Configuration/configWithReferencesAndImports.config");

            Assert.That(config.ImportsList.First(), Is.EqualTo("NHaml.Tests.Configuration, NHaml.Tests"));
        }
Exemple #11
0
        public void GetConfiguration_ConfigWithReferencesAndImports_ReferencedAssemblyListContainsCorrectElement()
        {
            var config = NHamlConfigurationSection.GetConfiguration("Configuration/configWithReferencesAndImports.config");

            Assert.That(config.ReferencedAssembliesList.First().ToLower(), Is.StringEnding("nhaml.tests.dll"));
        }
Exemple #12
0
 public void GetConfiguration_EmptyFileName_ThrowsFileNotFoundException()
 {
     Assert.Throws <FileNotFoundException>(() => NHamlConfigurationSection.GetConfiguration(""));
 }