public void ObjectExtensions_IsValid_NegativeDouble_Fail() { KeyValuePair <string, double> value = new KeyValuePair <string, double>("test", -1); var result = value.IsValid(); Assert.IsFalse(result); }
public void ObjectExtensions_IsValid_Success() { KeyValuePair <string, double> value = new KeyValuePair <string, double>("test", 1); var result = value.IsValid(); Assert.IsTrue(result); }
public void ObjectExtensions_IsValid_NullKey_Fail() { KeyValuePair <string, double> value = new KeyValuePair <string, double>(null, 1); var result = value.IsValid(); Assert.IsFalse(result); }
public IDictionary <string, string> GetSettingsAttributes(JObject contentItem) { var attributes = new Dictionary <string, string>(); var settingsConfig = contentItem.Value <JObject>("config"); if (settingsConfig != null) { var properties = settingsConfig.Properties().ToDictionary(x => x.Name, x => x.Value.ToString()); foreach (var property in ResolveAttributes(properties)) { var value = ResolveSettingValue(property); var attribute = new KeyValuePair <string, string>(property.Key, value); if (attribute.IsValid()) { attributes.AddKeyValuePair(attribute); } } } return(attributes); }