public async Task ConfigurationProvider_GetAppSettingValue_WhenConfigurationFileDoesNotExist_ShouldThrow() { // Arrange var testConfigurationProvider = new ConfigurationProviderLyft("thisFileNameDoesNotExist"); var testKey = "thisKeyDoesNotExist"; // Act try { await testConfigurationProvider.GetAppSettingValue(testKey); Assert.Fail("Expected a GetARideServiceMissingConfigurationFileException but no exception was thrown."); } catch (GetARideServiceMissingConfigurationFileException ex) { // Assert AssertEx.AssertExceptionMessageContains(new List <string>() { "cannot find", "configuration file" }, ex); } catch (Exception ex) { Assert.Fail("Expected a GetARideServiceMissingConfigurationFileException to be thrown, but a different " + "exception was thrown: " + ex.GetType() + " - " + ex.Message); } }
public async Task ConfigurationProvider_GetAppSettingValue_WhenConfigurationFileExistsAndSettingExists_ShouldReturnSetting() { // Arrange var testConfigurationProvider = new ConfigurationProviderLyft("appsettingsfortest.json"); var testKey = "testKey"; // Act var testValue = await testConfigurationProvider.GetAppSettingValue(testKey); // Assert Assert.AreEqual("testingValue", testValue); }
public RideSharingLyft(IHttpMessageHandlerFactory httpMessageHandlerFactory, ConfigurationProviderLyft configurationProvider, LyftToGetARyderTransformer lyftToGetARyderTransformer) : base(httpMessageHandlerFactory) { this._lyftGatewayConfiguration = configurationProvider.GetGatewayConfiguration(); this._lyftToGetARydertransformer = lyftToGetARyderTransformer; }