public async Task Given_MultipleComponents_When_Configure_Then_ComponentsAreConfigured()
        {
            var handle = await _environment.ConfigureAsync(x =>
            {
                var c1 = x.CreateComponentConfigSpecification <IConfigurationSpecification>(nameof(_component1));
                x.AddSpecification(c1);
                var c2 = x.CreateComponentConfigSpecification <IConfigurationSpecification>(nameof(_component2));
                x.AddSpecification(c2);
            });

            Assert.That(handle, Is.Not.Null);
            A.CallTo(() => _configSpec1.ApplyAsync(A <CancellationToken> ._)).MustHaveHappenedOnceExactly();
            A.CallTo(() => _configSpec2.ApplyAsync(A <CancellationToken> ._)).MustHaveHappenedOnceExactly();
            A.CallTo(() => _configHandle1.DisposeAsync()).MustNotHaveHappened();
            A.CallTo(() => _configHandle2.DisposeAsync()).MustNotHaveHappened();
        }
        public void SetUp()
        {
            _configHandle1 = A.Fake <IConfigurationHandle>();
            _configSpec1   = A.Fake <IConfigurationSpecification>();
            A.CallTo(() => _configSpec1.ApplyAsync(A <CancellationToken> ._)).Returns(_configHandle1);
            _component1 = A.Fake <IComponent>();
            A.CallTo(() => _component1.CreateConfigurationSpecification <IConfigurationSpecification>(A <IEventHandlerFactory> ._)).Returns(_configSpec1);
            var host1 = A.Fake <IHost>();

            A.CallTo(() => host1.Components).Returns(new ReadOnlyDictionary <string, IComponent>(new Dictionary <string, IComponent> {
                { nameof(_component1), _component1 }
            }));
            var host1Spec = A.Fake <IHostSpecification>();

            A.CallTo(() => host1Spec.Build()).Returns(host1);

            _configHandle2 = A.Fake <IConfigurationHandle>();
            _configSpec2   = A.Fake <IConfigurationSpecification>();
            A.CallTo(() => _configSpec2.ApplyAsync(A <CancellationToken> ._)).Returns(_configHandle2);
            _component2 = A.Fake <IComponent>();
            A.CallTo(() => _component2.CreateConfigurationSpecification <IConfigurationSpecification>(A <IEventHandlerFactory> ._)).Returns(_configSpec2);
            var host2 = A.Fake <IHost>();

            A.CallTo(() => host2.Components).Returns(new ReadOnlyDictionary <string, IComponent>(new Dictionary <string, IComponent> {
                { nameof(_component2), _component2 }
            }));
            var host2Spec = A.Fake <IHostSpecification>();

            A.CallTo(() => host2Spec.Build()).Returns(host2);

            _environment = Environment.Setup(x =>
            {
                x.AddHostSpecification(host1Spec);
                x.AddHostSpecification(host2Spec);
            });
        }