Exemple #1
0
        protected void AssertBuildProject(string projectPath, string projectName, string platform, string language = "", bool deleteAfterBuild = true)
        {
            (int exitCode, string outputFile)result = (1, string.Empty);

            // Build solution
            switch (platform)
            {
            case Platforms.Uwp:
                result = _fixture.BuildSolutionUwp(projectName, projectPath, platform);
                break;

            case Platforms.WinUI:
                result = _fixture.BuildSolutionWinUI(projectName, projectPath, platform, language);
                break;

            case Platforms.Wpf:
                result = _fixture.BuildSolutionWpf(projectName, projectPath, platform);
                break;
            }


            // Assert
            Assert.True(result.exitCode.Equals(0), $"Solution {projectName} was not built successfully. {Environment.NewLine}Errors found: {_fixture.GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details.");

            // Clean
            if (deleteAfterBuild)
            {
                Fs.SafeDeleteDirectory(projectPath);
            }
        }