public void when_add_null_as_api_it_should_fail()
        {
            var    configuration = new BrokerEgressConfiguration();
            Action sut           = () => configuration.AddApi(configuration: null);

            sut.Should().ThrowExactly <ArgumentNullException>();
        }
        public void when_same_api_added_second_time_it_should_fail()
        {
            var    configuration = new BrokerEgressConfiguration();
            var    api           = new EgressApiConfiguration();
            Action sut           = () => configuration.AddApi(api);

            sut.Should().NotThrow();
            sut.Should().ThrowExactly <PoezdConfigurationException>();
        }
        public void when_api_with_same_id_added_it_should_fail()
        {
            var configuration = new BrokerEgressConfiguration();

            const string sameId = "same id";
            var          api1   = new EgressApiConfiguration {
                Id = sameId
            };
            Action sut1 = () => configuration.AddApi(api1);

            sut1.Should().NotThrow();

            var api2 = new EgressApiConfiguration {
                Id = sameId
            };
            Action sut2 = () => configuration.AddApi(api2);

            sut2.Should().ThrowExactly <PoezdConfigurationException>();
        }
        public static BrokerEgressConfiguration CreateBrokerEgressConfiguration(bool shouldAddApis = true)
        {
            var configuration = new BrokerEgressConfiguration
            {
                Driver = new TestBrokerEgressDriver(new TestDriverState()),
                DriverConfiguration = new TestBrokerEgressDriverConfiguration(),
                EnterPipeFitterType = typeof(object),
                ExitPipeFitterType  = typeof(object)
            };

            if (shouldAddApis)
            {
                configuration.AddApi(CreateEgressApiConfiguration());
            }

            return(configuration);
        }