private string CreateProjectFile(AnalysisConfig config, string projectSnippet)
        {
            var projectDirectory = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext);
            var targetTestUtils  = new TargetsTestsUtils(TestContext);
            var projectTemplate  = targetTestUtils.GetProjectTemplate(config, projectDirectory, null, projectSnippet, null);

            return(targetTestUtils.CreateProjectFile(projectDirectory, projectTemplate));
        }
Exemple #2
0
        private BuildLog CreateProjectAndLoad(string projectSnippet)
        {
            projectSnippet += @"<Target Name=""DoNothing"" />";
            var projectDirectory = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext);
            var targetTestUtils  = new TargetsTestsUtils(TestContext);
            var projectTemplate  = targetTestUtils.GetProjectTemplate(null, projectDirectory, null, projectSnippet);
            var projectFile      = targetTestUtils.CreateProjectFile(projectDirectory, projectTemplate);

            return(BuildRunner.BuildTargets(TestContext, projectFile, "DoNothing"));
        }
Exemple #3
0
        private string CreateProjectFile(AnalysisConfig config, string projectSnippet)
        {
            var afterTargets = string.Join(";",
                                           TargetConstants.SetRoslynResultsTarget,
                                           TargetConstants.OverrideRoslynAnalysisTarget,
                                           TargetConstants.SetRoslynAnalysisPropertiesTarget
                                           );

            var projectDirectory = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext);
            var targetTestUtils  = new TargetsTestsUtils(TestContext);
            var projectTemplate  = targetTestUtils.GetProjectTemplate(config, projectDirectory, TestSpecificProperties, projectSnippet, TestSpecificImport);

            targetTestUtils.CreateCaptureDataTargetsFile(projectDirectory, afterTargets);

            return(targetTestUtils.CreateProjectFile(projectDirectory, projectTemplate));
        }
        private string CreateProjectFile(string testSpecificProjectXml)
        {
            var projectDirectory = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext);

            var targetsTestUtils = new TargetsTestsUtils(TestContext);

            var importsBeforeTargets = Path.Combine(projectDirectory, TargetConstants.ImportsBeforeFile);

            // Locate the real "ImportsBefore" target file
            File.Exists(importsBeforeTargets).Should().BeTrue("Test error: the SonarQube imports before target file does not exist. Path: {0}", importsBeforeTargets);

            var template = Integration.Tasks.IntegrationTests.Properties.Resources.ImportBeforeTargetTestsTemplate;

            var projectData = template.Replace("SQ_IMPORTS_BEFORE", importsBeforeTargets)
                              .Replace("TEST_SPECIFIC_XML", testSpecificProjectXml);

            var projectFilePath = targetsTestUtils.CreateProjectFile(projectDirectory, projectData);

            return(projectFilePath);
        }