Exemplo n.º 1
0
        public void ThrowOnInvalidBuildSection(string input, Type expectedException)
        {
            var parser        = new BuildSectionParser();
            var buildSections = GetBuildSections(input);

            Assert.Throws(expectedException, () => parser.ParseConfiguration(buildSections));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public void ParseBuildDefaultsSections(string input, BuildData expected)
        {
            var parser        = new BuildSectionParser();
            var buildSections = GetBuildSections(input);
            var actual        = parser.ParseDefaults(buildSections);

            actual.Should().BeEquivalentTo(expected);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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
                       ));
        }