Пример #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"));
		}