Пример #1
0
        public async void Build_Success()
        {
            var workingLocation = Path.Combine(AppContext.BaseDirectory, "working", "20180817.1");

            if (Directory.Exists(workingLocation))
            {
                Directory.Delete(workingLocation, true);
            }

            Directory.CreateDirectory(workingLocation);

            await GenerateTestProject("MyProject", Path.Combine(workingLocation, "src"));

            var taskConfig = new BuildTaskConfig
            {
                SourceLocation         = "src",
                OutputArtifactLocation = "artifact",
                WorkingLocation        = workingLocation
            };

            var provider = new Program(new string[] { GetArgString("main", "TestProject", taskConfig, new Dictionary <string, string>()) });

            var result = await provider.Build();

            Assert.Equal("", result.errorMessage);
            Assert.True(File.Exists(result.outputArtifact));
        }
Пример #2
0
        private string GetArgString(string process, string projectName, BuildTaskConfig taskConfig, Dictionary <string, string> additionalConfigs)
        {
            var dict = new Dictionary <string, object>
            {
                { "process", process },
                { "project", projectName },
                { "config", taskConfig },
                { "additional", additionalConfigs }
            };

            return(JsonConvert.SerializeObject(dict));
        }