public void Transform_EmptyString_EmptyStringReturned() { var value = String.Empty; var toUpperAttribute = new ToUpperAttribute(); var transformedValue = toUpperAttribute.Transform(value); Assert.AreEqual(String.Empty, transformedValue); }
public void Transform_LowerCaseText_UpperCaseTextReturned() { var value = "test"; var toUpperAttribute = new ToUpperAttribute(); var transformedValue = toUpperAttribute.Transform(value); Assert.AreEqual("TEST", transformedValue); }
public void ApplyTransform_IntField_ExceptionIsThrown() { var record = new MockRecord() { IntField = 10 }; var property = typeof(MockRecord).GetProperty(nameof(MockRecord.IntField)); var toUpperAttribute = new ToUpperAttribute(); toUpperAttribute.ApplyTransform(property, record); }
public void ApplyTransform_StringFieldWithMixedCaseValue_TextIsLowered() { var record = new MockRecord() { StringField = "Test" }; var property = typeof(MockRecord).GetProperty(nameof(MockRecord.StringField)); var toUpperAttribute = new ToUpperAttribute(); toUpperAttribute.ApplyTransform(property, record); Assert.AreEqual("TEST", record.StringField); }
public void ApplyTransform_StringFieldWithNullValue_ValueIsUnchanged() { var record = new MockRecord() { StringField = null }; var property = typeof(MockRecord).GetProperty(nameof(MockRecord.StringField)); var toUpperAttribute = new ToUpperAttribute(); toUpperAttribute.ApplyTransform(property, record); Assert.IsNull(record.StringField); }
public void ApplyTransform_StringFieldWithEmptyValue_ValueIsUnchanged() { var record = new MockRecord() { StringField = "" }; var property = typeof(MockRecord).GetProperty(nameof(MockRecord.StringField)); var toUpperAttribute = new ToUpperAttribute(); toUpperAttribute.ApplyTransform(property, record); Assert.AreEqual(String.Empty, record.StringField); }
public void Transform_NullValue_ExceptionIsThrown() { var toUpperAttribute = new ToUpperAttribute(); var transformedValue = toUpperAttribute.Transform(null); }
public static void MutateTransformsCharToUppercase() { var attribute = new ToUpperAttribute(); Assert.Equal('U', attribute.Mutate('u')); }
public static void MutateTransformsStringToUppercase() { var attribute = new ToUpperAttribute(); Assert.Equal("UPPERCASE", attribute.Mutate("uppercase")); }