示例#1
0
        public void FillIndexTemplate_SpecialCharsPresent_SpecialCharsReplaced()
        {
            _internalStorage.GetEmbeddedResource("TypeGen.Core.Templates.Index.tpl")
            .Returns("$tg{tab} | $tg{quot}");
            var generatorOptions = new GeneratorOptions {
                TabLength = 3
            };
            var templateService = new TemplateService(_internalStorage)
            {
                GeneratorOptions = generatorOptions
            };

            string actualDoubleQuote = templateService.FillIndexTemplate("");

            generatorOptions.SingleQuotes = true;
            string actualSingleQuote = templateService.FillIndexTemplate("");

            Assert.Equal("    | \"", actualDoubleQuote);
            Assert.Equal("    | '", actualSingleQuote);
        }
示例#2
0
        public void FillIndexTemplate_ValuesGiven_TemplateFilledWithValues()
        {
            _internalStorage.GetEmbeddedResource("TypeGen.Core.Templates.Index.tpl")
            .Returns("$tg{exports}");
            var templateService = new TemplateService(_internalStorage)
            {
                GeneratorOptions = new GeneratorOptions()
            };

            string actual = templateService.FillIndexTemplate("a");

            Assert.Equal("a", actual);
        }