[WorkItem(50)] // Regression test for Bug 50:MSBuild projects with missing ProjectGuids cause the build to fail public void WriteProjectInfoFile_MissingProjectGuid() { // Arrange var testFolder = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext); var task = new WriteProjectInfoFile { FullProjectPath = "c:\\fullPath\\project.proj", IsTest = true, OutputFolder = testFolder, ProjectName = "ProjectWithoutProjectGuid", ProjectLanguage = "C#" }; // No analysis results are supplied // Act var engine = new DummyBuildEngine(); task.BuildEngine = engine; var success = task.Execute(); // Assert success.Should().BeTrue("Not expecting the task to fail as this would fail the build"); engine.AssertNoErrors(); engine.AssertNoWarnings(); var projectInfoFilePath = Path.Combine(testFolder, ExpectedProjectInfoFileName); File.Exists(projectInfoFilePath).Should().BeTrue("Expecting the project info file to have been created"); }
private static void ExecuteAndCheckSuccess(Task task) { var dummyEngine = new DummyBuildEngine(); task.BuildEngine = dummyEngine; var taskSucess = task.Execute(); taskSucess.Should().BeTrue("Expecting the task to succeed"); dummyEngine.AssertNoErrors(); dummyEngine.AssertNoWarnings(); }
private static void ExecuteAndAssert(string[] references, string expectedTestReference, string expectedLog) { var dummyEngine = new DummyBuildEngine(); var task = new IsTestByReference { BuildEngine = dummyEngine, References = references }; var taskSucess = task.Execute(); taskSucess.Should().BeTrue("Expecting the task to succeed"); dummyEngine.AssertNoErrors(); dummyEngine.AssertNoWarnings(); dummyEngine.AssertSingleMessageExists(expectedLog); task.TestReference.Should().Be(expectedTestReference); }
private static bool ExecuteAndCheckSuccess(string analysisDir, string fullFileName) { var dummyEngine = new DummyBuildEngine(); var task = new IsTestFileByName { BuildEngine = dummyEngine, FullFilePath = fullFileName, AnalysisConfigDir = analysisDir }; var taskSucess = task.Execute(); taskSucess.Should().BeTrue("Expecting the task to succeed"); dummyEngine.AssertNoErrors(); dummyEngine.AssertNoWarnings(); return(task.IsTest); }
[TestCategory("IsTest")] // Regression test for bug http://jira.codehaus.org/browse/SONARMSBRU-11 public void IsTestFile_TimeoutIfConfigLocked_TaskFails() { // Arrange var testFolder = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext); var configFile = EnsureAnalysisConfig(testFolder, ".XX."); var dummyEngine = new DummyBuildEngine(); var task = new IsTestFileByName { BuildEngine = dummyEngine, FullFilePath = "XXX.proj", AnalysisConfigDir = testFolder }; var result = true; TaskUtilitiesTests.PerformOpOnLockedFile(configFile, () => result = task.Execute(), shouldTimeoutReadingConfig: true); result.Should().BeFalse("Expecting the task to fail if the config file could not be read"); dummyEngine.AssertNoWarnings(); dummyEngine.AssertSingleErrorExists(); }