Esempio n. 1
0
        public void FillClassPropertyWithDefaultValueTemplate_SpecialCharsPresent_SpecialCharsReplaced()
        {
            _internalStorage.GetEmbeddedResource("TypeGen.Core.Templates.ClassPropertyWithDefaultValue.tpl")
            .Returns("$tg{tab} | $tg{quot}");
            var generatorOptions = new GeneratorOptions {
                TabLength = 3
            };
            var templateService = new TemplateService(_internalStorage)
            {
                GeneratorOptions = generatorOptions
            };

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

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

            Assert.Equal("    | \"", actualDoubleQuote);
            Assert.Equal("    | '", actualSingleQuote);
        }
Esempio n. 2
0
        public void FillClassPropertyWithDefaultValueTemplate_ValuesGiven_TemplateFilledWithValues()
        {
            _internalStorage.GetEmbeddedResource("TypeGen.Core.Templates.ClassPropertyWithDefaultValue.tpl")
            .Returns("$tg{accessor} | $tg{name} | $tg{type} | $tg{defaultValue}");
            var templateService = new TemplateService(_internalStorage)
            {
                GeneratorOptions = new GeneratorOptions()
            };

            string actual = templateService.FillClassPropertyWithDefaultValueTemplate("a", "B", "c", "D");

            Assert.Equal("a | B | c | D", actual);
        }