public void Should_return_false_and_the_default_value_of_the_setting_if_the_setting_doesnt_exist() { string website = "http://www.johndoe.com"; int userId = 1; string userFullname = "John Doe"; string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider"; var settingsAsDictionary = new Dictionary <string, string>(); settingsAsDictionary.Add("website", website); settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname)); var settings = new ProviderSettings(settingsAsDictionary, dataParserType); string invalidSetting; var containsSettingName = settings.TryGet <string>("invalidsetting", out invalidSetting); Assert.That(containsSettingName, Is.False); Assert.That(invalidSetting, Is.Null); }
public void Should_return_true_and_the_setting_if_the_setting_exists() { string website = "http://www.johndoe.com"; int userId = 1; string userFullname = "John Doe"; string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider"; var settingsAsDictionary = new Dictionary <string, string>(); settingsAsDictionary.Add("website", website); settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname)); var settings = new ProviderSettings(settingsAsDictionary, dataParserType); User user; var containsSettingName = settings.TryGet <User>("user", out user); Assert.That(containsSettingName, Is.True); Assert.That(user, Is.Not.Null); }
public void Should_return_true_and_the_setting_if_the_setting_exists() { string website = "http://www.johndoe.com"; int userId = 1; string userFullname = "John Doe"; string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider"; var settingsAsDictionary = new Dictionary<string, string>(); settingsAsDictionary.Add("website", website); settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname)); var settings = new ProviderSettings(settingsAsDictionary, dataParserType); User user; var containsSettingName = settings.TryGet<User>("user", out user); Assert.That(containsSettingName, Is.True); Assert.That(user, Is.Not.Null); }
public void Should_return_false_and_the_default_value_of_the_setting_if_the_setting_doesnt_exist() { string website = "http://www.johndoe.com"; int userId = 1; string userFullname = "John Doe"; string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider"; var settingsAsDictionary = new Dictionary<string, string>(); settingsAsDictionary.Add("website", website); settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname)); var settings = new ProviderSettings(settingsAsDictionary, dataParserType); string invalidSetting; var containsSettingName = settings.TryGet<string>("invalidsetting", out invalidSetting); Assert.That(containsSettingName, Is.False); Assert.That(invalidSetting, Is.Null); }