Exemplo n.º 1
0
        public void GetComponents()
        {
            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);

            var components = context.GetComponents();

            Assert.That(components.Count, Is.EqualTo(2));
            Assert.That(components.Select(c => c.GetType()), Is.EquivalentTo(new[] { typeof(TestBuildComponentA), typeof(TestBuildComponentB) }));

            configA.SetComponent <TestBuildComponentC>();
            Assert.Throws <InvalidOperationException>(() => context.GetComponents());
        }