public void Build1ProjectWith2TargetAnd1TaskEach()
        {
            RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[2] {
                "Target1", "Target2"
            }, null, 100, null, (IBuildComponentHost)_commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition  target1  = new TargetDefinition("Target1", project1.ProjectXmlDocument);
            TargetDefinition  target2  = new TargetDefinition("Target2", project1.ProjectXmlDocument);
            TaskDefinition    task1    = new TaskDefinition("Task1", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            TaskDefinition    task2    = new TaskDefinition("Task2", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());

            target1.AddTask(task1);
            target1.AddTask(task2);
            project1.AddTarget(target1);
            project1.AddTarget(target2);

            test1.SubmitBuildRequest();

            task1.WaitForTaskToComplete();
            task2.WaitForTaskToComplete();
            test1.WaitForResults();
            test1.ValidateTargetBuilt("Target1");
            test1.ValidateTargetBuilt("Target2");
            test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null);
            test1.ValidateTargetEndResult("Target2", TargetResultCode.Success, null);
        }
        public void BuildDependentTargetWithFalseCondition()
        {
            ProjectDefinition project1 = new ProjectDefinition(FullProjectPath("1.proj"));
            TargetDefinition  target1  = new TargetDefinition("Target1", null, "Target2", project1.ProjectXmlDocument);
            TargetDefinition  target2  = new TargetDefinition("Target2", @"'1' == '2'", project1.ProjectXmlDocument);
            TaskDefinition    task1    = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            TaskDefinition    task2    = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());

            target1.AddTask(task1);
            target2.AddTask(task2);
            project1.AddTarget(target1);
            project1.AddTarget(target2);
            RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[1] {
                "Target1"
            }, null, 100, null, (IBuildComponentHost)_commonTests.Host);

            test1.ProjectDefinition = project1;

            test1.SubmitBuildRequest();

            task1.WaitForTaskToComplete();
            test1.WaitForResults();
            test1.ValidateTargetBuilt("Target1");
            test1.ValidateNonPrimaryTargetEndResult("Target2", TargetResultCode.Skipped, null);
            test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null);
        }
        public void Build1ProjectWith1TargetWhereTheTaskFail()
        {
            RequestDefinition test1    = new RequestDefinition(FullProjectPath("1.proj"), (IBuildComponentHost)_commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition  target1  = new TargetDefinition(RequestDefinition.defaultTargetName, null, project1.ProjectXmlDocument);
            TaskDefinition    task1    = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetStopWithErrorResult());

            target1.AddTask(task1);
            project1.AddTarget(target1);

            test1.SubmitBuildRequest();

            test1.WaitForResults();
            test1.ValidateTargetBuilt(RequestDefinition.defaultTargetName);
            test1.ValidateTargetEndResult(RequestDefinition.defaultTargetName, TargetResultCode.Failure, null);
        }
Example #4
0
        public void Build1ProjectWith1TargetWhereConditionIsTrue()
        {
            RequestDefinition test1    = new RequestDefinition(FullProjectPath("1.proj"), (IBuildComponentHost)this.commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition  target1  = new TargetDefinition(RequestDefinition.defaultTargetName, @"'1' == '1'", project1.ProjectXmlDocument);
            TaskDefinition    task1    = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());

            target1.AddTask(task1);
            project1.AddTarget(target1);

            test1.SubmitBuildRequest();

            test1.WaitForResults();
            test1.ValidateTargetBuilt(RequestDefinition.defaultTargetName);
            test1.ValidateTargetEndResult(RequestDefinition.defaultTargetName, TargetResultCode.Success, null);
        }
        public void Build1ProjectWith1TargetAnd2Task()
        {
            RequestDefinition test1    = new RequestDefinition(FullProjectPath("1.proj"), (IBuildComponentHost)_commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition  target1  = new TargetDefinition(RequestDefinition.defaultTargetName, project1.ProjectXmlDocument);
            TaskDefinition    task1    = new TaskDefinition("task1", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            TaskDefinition    task2    = new TaskDefinition("task2", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());

            target1.AddTask(task1);
            target1.AddTask(task2);
            project1.AddTarget(target1);

            test1.SubmitBuildRequest();

            task1.WaitForTaskToComplete();
            task2.WaitForTaskToComplete();
            test1.WaitForResults();
            test1.ValidateTargetBuilt(RequestDefinition.defaultTargetName);
            test1.ValidateTargetEndResult(RequestDefinition.defaultTargetName, TargetResultCode.Success, null);
        }
        public void Build1ProjectWith1TargetWhereTheTaskFail()
        {
            RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), (IBuildComponentHost)_commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition target1 = new TargetDefinition(RequestDefinition.defaultTargetName, null, project1.ProjectXmlDocument);
            TaskDefinition task1 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetStopWithErrorResult());
            target1.AddTask(task1);
            project1.AddTarget(target1);

            test1.SubmitBuildRequest();

            test1.WaitForResults();
            test1.ValidateTargetBuilt(RequestDefinition.defaultTargetName);
            test1.ValidateTargetEndResult(RequestDefinition.defaultTargetName, TargetResultCode.Failure, null);
        }
        public void BuildDependentTargetWithFalseCondition()
        {
            ProjectDefinition project1 = new ProjectDefinition(FullProjectPath("1.proj"));
            TargetDefinition target1 = new TargetDefinition("Target1", null, "Target2", project1.ProjectXmlDocument);
            TargetDefinition target2 = new TargetDefinition("Target2", @"'1' == '2'", project1.ProjectXmlDocument);
            TaskDefinition task1 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            TaskDefinition task2 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            target1.AddTask(task1);
            target2.AddTask(task2);
            project1.AddTarget(target1);
            project1.AddTarget(target2);
            RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[1] { "Target1" }, null, 100, null, (IBuildComponentHost)_commonTests.Host);
            test1.ProjectDefinition = project1;

            test1.SubmitBuildRequest();

            task1.WaitForTaskToComplete();
            test1.WaitForResults();
            test1.ValidateTargetBuilt("Target1");
            test1.ValidateNonPrimaryTargetEndResult("Target2", TargetResultCode.Skipped, null);
            test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null);
        }
        public void Build1ProjectWith2TargetAnd1TaskEach()
        {
            RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[2] { "Target1", "Target2" }, null, 100, null, (IBuildComponentHost)_commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition target1 = new TargetDefinition("Target1", project1.ProjectXmlDocument);
            TargetDefinition target2 = new TargetDefinition("Target2", project1.ProjectXmlDocument);
            TaskDefinition task1 = new TaskDefinition("Task1", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            TaskDefinition task2 = new TaskDefinition("Task2", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            target1.AddTask(task1);
            target1.AddTask(task2);
            project1.AddTarget(target1);
            project1.AddTarget(target2);

            test1.SubmitBuildRequest();

            task1.WaitForTaskToComplete();
            task2.WaitForTaskToComplete();
            test1.WaitForResults();
            test1.ValidateTargetBuilt("Target1");
            test1.ValidateTargetBuilt("Target2");
            test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null);
            test1.ValidateTargetEndResult("Target2", TargetResultCode.Success, null);
        }
        public void Build1ProjectWith1TargetAnd2Task()
        {
            RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), (IBuildComponentHost)_commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition target1 = new TargetDefinition(RequestDefinition.defaultTargetName, project1.ProjectXmlDocument);
            TaskDefinition task1 = new TaskDefinition("task1", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            TaskDefinition task2 = new TaskDefinition("task2", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            target1.AddTask(task1);
            target1.AddTask(task2);
            project1.AddTarget(target1);

            test1.SubmitBuildRequest();

            task1.WaitForTaskToComplete();
            task2.WaitForTaskToComplete();
            test1.WaitForResults();
            test1.ValidateTargetBuilt(RequestDefinition.defaultTargetName);
            test1.ValidateTargetEndResult(RequestDefinition.defaultTargetName, TargetResultCode.Success, null);
        }
Example #10
0
        public void Build1ProjectWith1TargetWhereConditionIsTrue()
        {
            RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), (IBuildComponentHost)this.commonTests.Host);
            ProjectDefinition project1 = test1.ProjectDefinition;
            TargetDefinition target1 = new TargetDefinition(RequestDefinition.defaultTargetName, @"'1' == '1'", project1.ProjectXmlDocument);
            TaskDefinition task1 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult());
            target1.AddTask(task1);
            project1.AddTarget(target1);

            test1.SubmitBuildRequest();

            test1.WaitForResults();
            test1.ValidateTargetBuilt(RequestDefinition.defaultTargetName);
            test1.ValidateTargetEndResult(RequestDefinition.defaultTargetName, TargetResultCode.Success, null);
        }