private ProjectInfo ExecuteAndCheckSucceeds(Task task, string testFolder) { string expectedOutputFile = Path.Combine(testFolder, ExpectedProjectInfoFileName); Assert.IsFalse(File.Exists(expectedOutputFile), "Test error: output file should not exist before the task is executed"); bool result = task.Execute(); Assert.IsTrue(result, "Expecting the task execution to succeed"); Assert.IsTrue(File.Exists(expectedOutputFile), "Expected output file was not created by the task. Expected: {0}", expectedOutputFile); this.TestContext.AddResultFile(expectedOutputFile); ProjectInfo reloadedProjectInfo = ProjectInfo.Load(expectedOutputFile); Assert.IsNotNull(reloadedProjectInfo, "Not expecting the reloaded project info file to be null"); return reloadedProjectInfo; }
private static void ExecuteAndCheckSuccess(Task task) { DummyBuildEngine dummyEngine = new DummyBuildEngine(); task.BuildEngine = dummyEngine; bool taskSucess = task.Execute(); Assert.IsTrue(taskSucess, "Expecting the task to succeed"); dummyEngine.AssertNoErrors(); dummyEngine.AssertNoWarnings(); }