Beispiel #1
0
        public void Transform_UpperCaseText_LowerCaseTextReturned()
        {
            var value            = "TEST";
            var toLowerAttribute = new ToLowerAttribute();
            var transformedValue = toLowerAttribute.Transform(value);

            Assert.AreEqual("test", transformedValue);
        }
Beispiel #2
0
        public void Transform_EmptyString_EmptyStringReturned()
        {
            var value            = String.Empty;
            var toLowerAttribute = new ToLowerAttribute();
            var transformedValue = toLowerAttribute.Transform(value);

            Assert.AreEqual(String.Empty, transformedValue);
        }
Beispiel #3
0
        public void ApplyTransform_IntField_ExceptionIsThrown()
        {
            var record = new MockRecord()
            {
                IntField = 10
            };
            var property         = typeof(MockRecord).GetProperty(nameof(MockRecord.IntField));
            var toLowerAttribute = new ToLowerAttribute();

            toLowerAttribute.ApplyTransform(property, record);
        }
Beispiel #4
0
        public void ApplyTransform_StringFieldWithMixedCaseValue_TextIsLowered()
        {
            var record = new MockRecord()
            {
                StringField = "Test"
            };
            var property         = typeof(MockRecord).GetProperty(nameof(MockRecord.StringField));
            var toLowerAttribute = new ToLowerAttribute();

            toLowerAttribute.ApplyTransform(property, record);

            Assert.AreEqual("test", record.StringField);
        }
Beispiel #5
0
        public void ApplyTransform_StringFieldWithNullValue_ValueIsUnchanged()
        {
            var record = new MockRecord()
            {
                StringField = null
            };
            var property         = typeof(MockRecord).GetProperty(nameof(MockRecord.StringField));
            var toLowerAttribute = new ToLowerAttribute();

            toLowerAttribute.ApplyTransform(property, record);

            Assert.IsNull(record.StringField);
        }
Beispiel #6
0
        public void ApplyTransform_StringFieldWithEmptyValue_ValueIsUnchanged()
        {
            var record = new MockRecord()
            {
                StringField = ""
            };
            var property         = typeof(MockRecord).GetProperty(nameof(MockRecord.StringField));
            var toLowerAttribute = new ToLowerAttribute();

            toLowerAttribute.ApplyTransform(property, record);

            Assert.AreEqual(String.Empty, record.StringField);
        }
Beispiel #7
0
 public void Transform_NullValue_ExceptionIsThrown()
 {
     var toLowerAttribute = new ToLowerAttribute();
     var transformedValue = toLowerAttribute.Transform(null);
 }
Beispiel #8
0
        public static void MutateTransformsCharToLowercase()
        {
            var attribute = new ToLowerAttribute();

            Assert.Equal('l', attribute.Mutate('L'));
        }
Beispiel #9
0
        public static void MutateTransformsStringToLowercase()
        {
            var attribute = new ToLowerAttribute();

            Assert.Equal("lowercase", attribute.Mutate("LOWERCASE"));
        }