public void FillInterfaceDefaultExportTemplate_SpecialCharsPresent_SpecialCharsReplaced() { //arrange var generatorOptions = new GeneratorOptions { TabLength = 3 }; var generatorOptionsProvider = new GeneratorOptionsProvider { GeneratorOptions = generatorOptions }; _internalStorage.GetEmbeddedResource("TypeGen.Core.Templates.InterfaceDefaultExport.tpl") .Returns("$tg{tab} | $tg{quot}"); var templateService = new TemplateService(_internalStorage, generatorOptionsProvider); //act string actualDoubleQuote = templateService.FillInterfaceDefaultExportTemplate("", "", "", "", "", "", ""); generatorOptions.SingleQuotes = true; string actualSingleQuote = templateService.FillInterfaceDefaultExportTemplate("", "", "", "", "", "", ""); //assert Assert.Equal(" | \"", actualDoubleQuote); Assert.Equal(" | '", actualSingleQuote); }
public void FillInterfaceDefaultExportTemplate_ValuesGiven_TemplateFilledWithValues() { //arrange var generatorOptionsProvider = new GeneratorOptionsProvider { GeneratorOptions = new GeneratorOptions() }; _internalStorage.GetEmbeddedResource("TypeGen.Core.Templates.InterfaceDefaultExport.tpl") .Returns("$tg{imports} | $tg{name} | $tg{exportName} | $tg{extends} | $tg{properties} | $tg{customHead} | $tg{customBody}"); var templateService = new TemplateService(_internalStorage, generatorOptionsProvider); //act string actual = templateService.FillInterfaceDefaultExportTemplate("a", "B", "c", "D", "e", "F", "g"); //assert Assert.Equal("a | B | c | D | e | F | g", actual); }