private void CheckTitleCase(PropertyNameFormatter formatter) { Assert.That(formatter.Format("SomeCoolProperty"), Is.EqualTo("Some Cool Property")); Assert.That(formatter.Format("someCoolProperty"), Is.EqualTo("Some Cool Property")); Assert.That(formatter.Format("prop"), Is.EqualTo("Prop")); Assert.That(formatter.Format("PropP"), Is.EqualTo("Prop P")); Assert.That(formatter.Format("Some Cool Property"), Is.EqualTo("Some Cool Property")); }
public bool SetProperty(string propertyName, object value, PropertyNameSource propertyNameSource = PropertyNameSource.Default) { if (string.IsNullOrEmpty(propertyName)) { return(false); } var parsedProperty = _valueParser.Parse(value); if (!parsedProperty.IsValid) { return(false); } string bindingProp; if (_specialPropsBindings.TryGetValue(propertyName.ToLower(), out bindingProp)) { SpecialProps[bindingProp] = parsedProperty.Value; } else { switch (_messagePropetiesRules) { case MessagePropetiesRules.None: break; case MessagePropetiesRules.NumericsOnly: if (!_valueParser.IsNumeric(parsedProperty.Value)) { return(false); } break; case MessagePropetiesRules.ListsOnly: if (!_valueParser.IsEnumerable(parsedProperty.Value)) { return(false); } break; default: throw new ArgumentOutOfRangeException(); } Props[_nameFormatter.Format(propertyName, propertyNameSource)] = parsedProperty.Value; } return(true); }
private void ProcessObjectProperty(ObjectProperty objectProperty) { string specialProperty = mapRawNameToSpecialPropertyFn(objectProperty.PropertyName); if (specialProperty != null) { SpecialProperties[specialProperty] = objectProperty; } else { string formattedPropertyName = PropertyNameFormatter.Format(objectProperty, config); UserProperties[formattedPropertyName] = objectProperty; } }
private void CheckDefault(PropertyNameFormatter formatter) { Assert.That(formatter.Format("SomeCoolProperty"), Is.EqualTo("SomeCoolProperty")); Assert.That(formatter.Format("someCoolProperty"), Is.EqualTo("someCoolProperty")); }