示例#1
0
        public void Transform_EmptyString_EmptyStringReturned()
        {
            var value            = String.Empty;
            var toUpperAttribute = new ToUpperAttribute();
            var transformedValue = toUpperAttribute.Transform(value);

            Assert.AreEqual(String.Empty, transformedValue);
        }
示例#2
0
        public void Transform_LowerCaseText_UpperCaseTextReturned()
        {
            var value            = "test";
            var toUpperAttribute = new ToUpperAttribute();
            var transformedValue = toUpperAttribute.Transform(value);

            Assert.AreEqual("TEST", transformedValue);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
 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"));
		}