Пример #1
0
        public void HasRequiredComponent_WithMissingRequiredComponent_IsFalse()
        {
            var step     = new TestBuildStepWithRequirements();
            var pipeline = BuildPipeline.CreateInstance(p => p.BuildSteps.Add(step));
            var config   = BuildConfiguration.CreateInstance();
            var context  = new BuildContext(pipeline, config);

            Assert.That(step.HasRequiredComponent <TestRequiredComponentA>(context), Is.False);
            Assert.That(step.HasRequiredComponent <TestRequiredComponentB>(context), Is.False);
        }
Пример #2
0
        public void HasRequiredComponent_WithInvalidType_Throws()
        {
            var step     = new TestBuildStepWithRequirements();
            var pipeline = BuildPipeline.CreateInstance(p => p.BuildSteps.Add(step));
            var config   = BuildConfiguration.CreateInstance();
            var context  = new BuildContext(pipeline, config);

            Assert.Throws <InvalidOperationException>(() => step.HasRequiredComponent <TestOptionalComponentA>(context));
            Assert.Throws <ArgumentNullException>(() => step.HasRequiredComponent(context, null));
            Assert.Throws <InvalidOperationException>(() => step.HasRequiredComponent(context, typeof(object)));
            Assert.Throws <InvalidOperationException>(() => step.HasRequiredComponent(context, typeof(TestInvalidComponent)));
        }
Пример #3
0
        public void HasRequiredComponent_IsTrue()
        {
            var step     = new TestBuildStepWithRequirements();
            var pipeline = BuildPipeline.CreateInstance(p => p.BuildSteps.Add(step));
            var config   = BuildConfiguration.CreateInstance((c) =>
            {
                c.SetComponent(new TestRequiredComponentA());
                c.SetComponent(new TestRequiredComponentB());
            });
            var context = new BuildContext(pipeline, config);

            Assert.That(step.HasRequiredComponent <TestRequiredComponentA>(context), Is.True);
            Assert.That(step.HasRequiredComponent <TestRequiredComponentB>(context), Is.True);
        }