Пример #1
0
        [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");
        }
Пример #2
0
        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);
        }
Пример #4
0
        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);
        }