public void ThrowOnInvalidBuildSection(string input, Type expectedException) { var parser = new BuildSectionParser(); var buildSections = GetBuildSections(input); Assert.Throws(expectedException, () => parser.ParseConfiguration(buildSections)); }
public void ParseBuildConfigurationSections(string input, BuildData defaults, BuildData[] expected) { var parser = new BuildSectionParser(); var buildSections = GetBuildSections(input); var actual = parser.ParseConfiguration(buildSections, defaults); actual.Should().BeEquivalentTo(expected); }
public void ParseBuildDefaultsSections(string input, BuildData expected) { var parser = new BuildSectionParser(); var buildSections = GetBuildSections(input); var actual = parser.ParseDefaults(buildSections); actual.Should().BeEquivalentTo(expected); }
private ModuleDefaultsParser GetParser() { var depSectionItemParser = new DepSectionItemParser(); var depsSectionParser = new DepsSectionParser(depSectionItemParser); var installSectionParser = new InstallSectionParser(); var buildSectionParser = new BuildSectionParser(); var hooksSectionParser = new HooksSectionParser(); var settingsSectionParser = new SettingsSectionParser(); var moduleDefaultsParser = new ModuleDefaultsParser(hooksSectionParser, depsSectionParser, settingsSectionParser, buildSectionParser, installSectionParser); return(moduleDefaultsParser); }
public string DefineCorrectDefaultToolVersion(string toolName, string settingVersion, string defaultVersion) { var settings = new CementSettings { DefaultMsBuildVersion = settingVersion }; var input = $@"build: target: Solution.sln configuration: Release tool: name: {toolName} "; var defaults = new BuildData(null, null, new Tool(null, defaultVersion), new List <string>(), string.Empty); var parser = new BuildSectionParser(settings); var buildSections = GetBuildSections(input); var actual = parser.ParseConfiguration(buildSections, defaults); return(actual?[0].Tool.Version); }
private static ModuleYamlParser Create() { var configSectionTitleParser = new ConfigSectionTitleParser(); var depLineParser = new DepSectionItemParser(); var depsSectionParser = new DepsSectionParser(depLineParser); var installSectionParser = new InstallSectionParser(); var buildSectionParser = new BuildSectionParser(); var configSectionParser = new ConfigSectionParser(configSectionTitleParser, installSectionParser, depsSectionParser, buildSectionParser); var hooksSectionParser = new HooksSectionParser(); var settingsSectionParser = new SettingsSectionParser(); var moduleDefaultsParser = new ModuleDefaultsParser(hooksSectionParser, depsSectionParser, settingsSectionParser, buildSectionParser, installSectionParser); var depsSectionMerger = new DepsSectionMerger(); var installSectionMerger = new InstallSectionMerger(); return(new ModuleYamlParser( moduleDefaultsParser, configSectionParser, installSectionMerger, depsSectionMerger )); }