public void GivenBusInitializerOptionsWhenSetInvalidConnectionNameShouldThrow(string name) { var builder = new BusInitializerOptionsBuilder(new ConfigurationBuilder().Build()); Action action = () => builder .SetConnectionName(name) .Build(); action.Should().Throw <ArgumentException>(); }
public void GivenBusInitializerOptionsWhenSetConnectionNameShouldLoadConnectionString() { const string CONNECTION_NAME = "RabbitMQ"; var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair <string, string>($"ConnectionStrings:{CONNECTION_NAME}", CONNECTION_STRING) }).Build(); var builder = new BusInitializerOptionsBuilder(configuration); var options = builder .SetConnectionName(CONNECTION_NAME) .SetSerializer <BusSerializerStub>() .Build(); options.ConnectionString.Should().Be(CONNECTION_STRING); }