public void ShouldStillHavePropertNameAfterCasting()
        {
            PropertyInfo info = typeof(Regular).GetProperty("Value");

            ReflectorProperty <Regular, string> property = new ReflectorProperty <Regular, string>(info);
            ReflectorProperty <Regular, string> casted   = property.Cast(x => x.ToLower(), x => x.ToUpper());

            Assert.That(casted.Name, Is.EqualTo("Value"));
        }
        public void ShouldHandleCastedSetConversionInInstance()
        {
            Regular      regular = new Regular();
            PropertyInfo info    = typeof(Regular).GetProperty("Value");

            ReflectorProperty <Regular, string> property = new ReflectorProperty <Regular, string>(info);
            ReflectorProperty <Regular, string> casted   = property.Cast(x => x.ToLower(), x => x.ToUpper());

            casted.SetValue(regular, "cDe");
            Assert.That(regular.Value, Is.EqualTo("CDE"));
        }
        public void ShouldHandleCastedGetConversion()
        {
            Regular item = new Regular {
                Value = "aBc"
            };
            PropertyInfo info = typeof(Regular).GetProperty("Value");

            ReflectorProperty <Regular, string> property = new ReflectorProperty <Regular, string>(info);
            ReflectorProperty <Regular, string> casted   = property.Cast(x => x.ToLower(), x => x.ToUpper());

            Assert.That(casted.GetValue(item), Is.EqualTo("abc"));
        }
        public void ShouldHandleCastedSetConversionInSubstitute()
        {
            Addressable          source     = new MemoryMock();
            Serializer <Regular> serializer = new Serializer <Regular>();

            PropertyInfo         info    = typeof(Regular).GetProperty("Value");
            Substitute <Regular> regular = new Substitute <Regular>(serializer, source);

            ReflectorProperty <Regular, string> property = new ReflectorProperty <Regular, string>(info);
            ReflectorProperty <Regular, string> casted   = property.Cast(x => x.ToLower(), x => x.ToUpper());

            casted.SetValue(regular, () => "cDe");
            Assert.That(regular.AsDynamic().Value, Is.EqualTo("CDE"));
        }