Example #1
0
        public void IsComponentInherited()
        {
            var pipeline = new TestBuildPipelineWithUsedComponents();
            var configB  = BuildConfiguration.CreateInstance(c => c.SetComponent <TestBuildComponentB>());
            var configA  = BuildConfiguration.CreateInstance(c =>
            {
                c.SetComponent <TestBuildComponentA>();
                c.AddDependency(configB);
            });
            var context = new TestContextBase(pipeline, configA);

            Assert.That(context.IsComponentInherited <TestBuildComponentA>(), Is.False);
            Assert.That(context.IsComponentInherited <TestBuildComponentB>(), Is.True);
            Assert.Throws <InvalidOperationException>(() => context.IsComponentInherited <TestBuildComponentC>());

            Assert.Throws <ArgumentNullException>(() => context.IsComponentInherited(null));
            Assert.Throws <InvalidOperationException>(() => context.IsComponentInherited(typeof(object)));
            Assert.Throws <InvalidOperationException>(() => context.IsComponentInherited(typeof(TestBuildComponentInvalid)));
        }