Exemplo n.º 1
0
 private void AssertExecutionStatus(TestBuild build, ExecutionStatus dependencyTargetStatus, ExecutionStatus executeTargetStatus)
 {
     using (new AssertionScope())
     {
         build.Should().HaveTargetWithExecutionStatus <TestBuild>(x => x.Dependency, dependencyTargetStatus);
         build.Should().HaveTargetWithExecutionStatus <TestBuild>(x => x.Execute, executeTargetStatus);
     }
 }
Exemplo n.º 2
0
        private void ExecuteBuild(ExecutableTarget[] skippedTargets = null)
        {
            string[] SelectNames(ExecutableTarget[] targets) => targets?.Select(x => x.Name).ToArray();

            var build = new TestBuild();

            build.ExecutableTargets = new[] { A, B, C };
            build.ExecutionPlan     = new[] { A, B, C };
            build.ExecutionPlan.ForEach(x => x.Status = ExecutionStatus.NotRun);
            BuildExecutor.Execute(build, SelectNames(skippedTargets));
        }
        public void Test()
        {
            var build   = new TestBuild();
            var targets = ExecutableTargetFactory.CreateAll(build, x => x.E);

            var a = targets.Single(x => x.Name == nameof(ITestBuild.A));
            var b = targets.Single(x => x.Name == nameof(ITestBuild.B));
            var c = targets.Single(x => x.Name == nameof(ITestBuild.C));
            var d = targets.Single(x => x.Name == nameof(ITestBuild.D));
            var e = targets.Single(x => x.Name == nameof(TestBuild.E));

            targets.Single(x => x.IsDefault).Should().Be(e);

            a.Description.Should().Be(Description);
            a.Requirements.Should().Equal(Requirement);
            a.Actions.Should().Equal(Action);
            a.AllDependencies.Should().BeEmpty();

            b.DependencyBehavior.Should().Be(DependencyBehavior.Execute);
            b.StaticConditions.Should().Equal(StaticCondition);
            b.ExecutionDependencies.Should().Equal(d);
            b.TriggerDependencies.Should().Equal(c);
            b.AllDependencies.Should().NotBeEmpty();

            c.Triggers.Should().Equal(b);
            c.TriggerDependencies.Should().Equal(d);
            c.ExecutionDependencies.Should().Equal(b);
            c.OrderDependencies.Should().Equal(d);
            c.AllDependencies.Should().NotBeEmpty();

            d.DependencyBehavior.Should().Be(DependencyBehavior.Skip);
            d.DynamicConditions.Should().Equal(DynamicCondition);
            d.OrderDependencies.Should().Equal(b);
            d.Triggers.Should().Equal(c);
            d.AllDependencies.Should().NotBeEmpty();

            e.ExecutionDependencies.Should().Equal(a);
        }