public void GivenConnectionStringNotInConfiguration_WhenAskingForValue_ThenItShouldThrow() { // arrange Environment.SetEnvironmentVariable(new EventHubConnectionStringKey(), null); Environment.GetEnvironmentVariables().Clear(); IEventHubConfiguration eventHubConfiguration = new EventHubConfiguration(); // act Action action = () => eventHubConfiguration.ConnectionString(); // assert action.Should().Throw <ConfigurationItemNotFoundException>(); }
public void GivenConnectionStringInConfiguration_WhenAskingForValue_ThenItShouldReturnCorrectValue() { // arrange const string expected = "connection-string"; Environment.SetEnvironmentVariable(new EventHubConnectionStringKey(), expected); IEventHubConfiguration eventHubConfiguration = new EventHubConfiguration(); // act string actual = eventHubConfiguration.ConnectionString(); // assert actual.Should().Be(expected); }