public void Get_WhenSettingExistsAndInterceptorPresent_ReturnsSetting() { _wrapper = new AppSettingsExtended(_underlyingConfiguration, new List<IConfigurationInterceptor> { new TestInterceptor("return this") }); var val = _wrapper.Get("key-here"); Assert.That(val, Is.EqualTo("return this")); }
public void SetUp() { _underlyingConfiguration = new NameValueCollection { { "key-here", "junk" } }; _wrapper = new AppSettingsExtended(_underlyingConfiguration, null, new[] { new UriConverter() } /* Default */); }
public void SetUp() { _underlyingAppSettingStore = new NameValueCollection(); _connectionStrings = new ConnectionStringSettingsCollection(); _appSettings = new AppSettingsExtended(_underlyingAppSettingStore); _interceptor = new ConfigurationSubstitutionInterceptor(); _connectionStringsExtended = new ConnectionStringsExtended(_connectionStrings, _appSettings, new[] { _interceptor }); }
public void SetUp() { _underlyingAppSettingStore = new NameValueCollection(); _connectionStrings = new ConnectionStringSettingsCollection(); _appSettings = new AppSettingsExtended(_underlyingAppSettingStore); _interceptor = new ConfigurationSubstitutionInterceptor(); _connectionStringsExtended = new ConnectionStringsExtended(_connectionStrings, _appSettings, new[] {_interceptor}); }
public void Keys_UnderlyingCollectionHasAnItem_ReturnsKeysOfUnderlyingConfigCollection() { _wrapper = new AppSettingsExtended(new NameValueCollection { { "test", "value" } }); Assert.That(_wrapper.Keys[0], Is.EqualTo("test")); }
public void Count_UnderlyingCollectionHasAnItem_ReturnsCountOfUnderlyingConfigCollection() { _wrapper = new AppSettingsExtended(new NameValueCollection { { "test", "value" } }); Assert.That(_wrapper.Count, Is.EqualTo(1)); }
public void IndexerById_WhenSettingExists_RunsAnyRegisteredInterceptorsAndReturnsSetting() { _wrapper = new AppSettingsExtended(_underlyingConfiguration, new List<IConfigurationInterceptor>{new TestInterceptor("return this")}); var val = _wrapper[0]; Assert.That(val, Is.EqualTo("return this")); }
public void Get_WhenSettingExistsAndInterceptorPresent_ReturnsSetting() { _wrapper = new AppSettingsExtended(_underlyingConfiguration, new List <IConfigurationInterceptor> { new TestInterceptor("return this") }); var val = _wrapper.Get("key-here"); Assert.That(val, Is.EqualTo("return this")); }
public void IndexerById_WhenSettingExists_RunsAnyRegisteredInterceptorsAndReturnsSetting() { _wrapper = new AppSettingsExtended(_underlyingConfiguration, new List <IConfigurationInterceptor> { new TestInterceptor("return this") }); var val = _wrapper[0]; Assert.That(val, Is.EqualTo("return this")); }
public void Indexer_WhenSettingDoesNotExist_AndInterceptorPresentReturnsNull() { _underlyingConfiguration.Clear(); _wrapper = new AppSettingsExtended(_underlyingConfiguration, new List <IConfigurationInterceptor> { new NullInterceptor() }); var val = _wrapper["key-here"]; Assert.That(val, Is.Null); }
public void Setting_RequestATypeWithAUserSuppliedConverter_Converts() { _underlyingConfiguration = new NameValueCollection { { "key-here", "junk" } }; _wrapper = new AppSettingsExtended(_underlyingConfiguration, null, new[] { new UserConverterExample() }); var val = _wrapper.AppSetting <UserType>("key-here"); Assert.That(val, Is.TypeOf <UserType>()); }
public void ReturnsNoExceptionIfAllKeysAreConfigured() { // arrange var appSettings = new AppSettingsExtended(new NameValueCollection { { Constants.SettingKeys.ApiKey, "ApiKey" }, { Constants.SettingKeys.ApiSecret, "ApiSecret" }, { Constants.SettingKeys.Token, "Token" }, }); mockConfigurationManager.Setup(c => c.AppSettings).Returns(appSettings); // act // assert Assert.DoesNotThrow(() => new MixpanelData(mockConfigurationManager.Object, mockHttpClient.Object)); }
public void ShouldSetAllProperties() { // arrange var expectedApiKey = "expectedApiKey"; var expectedApiSecret = "expectedApiSecret"; var expectedToken = "expectedToken"; var appSettings = new AppSettingsExtended(new NameValueCollection { { Constants.SettingKeys.ApiKey, expectedApiKey }, { Constants.SettingKeys.ApiSecret, expectedApiSecret }, { Constants.SettingKeys.Token, expectedToken }, }); mockConfigurationManager.Setup(c => c.AppSettings).Returns(appSettings); // act var sut = new MixpanelData(mockConfigurationManager.Object, mockHttpClient.Object); // assert Assert.Equal(expectedApiKey, sut.ApiKey); Assert.Equal(expectedApiSecret, sut.ApiSecret); Assert.Equal(expectedToken, sut.Token); }
public void Keys_UnderlyingCollectionHasAnItem_ReturnsKeysOfUnderlyingConfigCollection() { _wrapper = new AppSettingsExtended(new NameValueCollection{{"test", "value"}}); Assert.That(_wrapper.Keys[0], Is.EqualTo("test")); }
public void Count_UnderlyingCollectionHasAnItem_ReturnsCountOfUnderlyingConfigCollection() { _wrapper = new AppSettingsExtended(new NameValueCollection{{"test", "value"}}); Assert.That(_wrapper.Count, Is.EqualTo(1)); }
public void Setting_RequestATypeWithAUserSuppliedConverter_Converts() { _underlyingConfiguration = new NameValueCollection { { "key-here", "junk" } }; _wrapper = new AppSettingsExtended(_underlyingConfiguration, null, new[] { new UserConverterExample() }); var val = _wrapper.AppSetting<UserType>("key-here"); Assert.That(val, Is.TypeOf<UserType>()); }
public void SetUp() { _underlyingConfiguration = new NameValueCollection {{"key-here", "junk"}}; _wrapper = new AppSettingsExtended(_underlyingConfiguration, null, new[] {new UriConverter()} /* Default */); }
public void Indexer_WhenSettingDoesNotExist_AndInterceptorPresentReturnsNull() { _underlyingConfiguration.Clear(); _wrapper = new AppSettingsExtended(_underlyingConfiguration, new List<IConfigurationInterceptor> { new NullInterceptor() }); var val = _wrapper["key-here"]; Assert.That(val, Is.Null); }
private void SetupAppSettings(NameValueCollection nvc = null) { nvc = nvc ?? new NameValueCollection(); _appSettings = new AppSettingsExtended(nvc); _rsfp = new RemoveSpuriousFilenameParts(_appSettings, _mockFileSystem.Object); }
private void SetupAppSettings(NameValueCollection nvc = null) { nvc = nvc ?? new NameValueCollection(); _appSettings = new AppSettingsExtended(nvc); _dasts = new DetectAndSortTvSeries(); }