public void ProjectWithPredictedTargetsAreHonored() { var targetPredictedProject = CreateProjectWithPredictions( predictedTargetsToExecute: PredictedTargetsToExecute.CreatePredictedTargetsToExecute(new[] { "foo" })); var process = Start() .Add(targetPredictedProject) .ScheduleAll() .AssertSuccess() .RetrieveSuccessfulProcess(targetPredictedProject); var arguments = RetrieveProcessArguments(process); Assert.Contains("/t:foo", arguments); }
/// <summary> /// Helper method to create a project with predictions rooted at the test root /// </summary> /// <returns></returns> public ProjectWithPredictions CreateProjectWithPredictions( string projectName = null, IReadOnlyCollection <AbsolutePath> inputs = null, IReadOnlyCollection <AbsolutePath> outputs = null, IEnumerable <ProjectWithPredictions> references = null, GlobalProperties globalProperties = null, PredictedTargetsToExecute predictedTargetsToExecute = null) { var projectNameRelative = RelativePath.Create(StringTable, projectName ?? "testProj.proj"); var projectWithPredictions = new ProjectWithPredictions( TestPath.Combine(PathTable, projectNameRelative), globalProperties ?? GlobalProperties.Empty, inputs ?? CollectionUtilities.EmptyArray <AbsolutePath>(), outputs ?? CollectionUtilities.EmptyArray <AbsolutePath>(), projectReferences: references?.ToArray() ?? CollectionUtilities.EmptyArray <ProjectWithPredictions>(), predictedTargetsToExecute: predictedTargetsToExecute ?? PredictedTargetsToExecute.CreatePredictedTargetsToExecute(new[] { "Build" })); return(projectWithPredictions); }