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

            string actualDoubleQuote = templateService.FillImportTemplate("", "", "");

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

            Assert.Equal("    | \"", actualDoubleQuote);
            Assert.Equal("    | '", actualSingleQuote);
        }
예제 #2
0
        public void FillImportTemplate_ValuesGiven_TemplateFilledWithValues(string typeAlias, string expectedResult)
        {
            _internalStorage.GetEmbeddedResource("TypeGen.Core.Templates.Import.tpl")
            .Returns("$tg{name} | $tg{aliasText} | $tg{path}");
            var templateService = new TemplateService(_internalStorage)
            {
                GeneratorOptions = new GeneratorOptions()
            };

            string actual = templateService.FillImportTemplate("a", typeAlias, "c");

            Assert.Equal(expectedResult, actual);
        }