예제 #1
0
        public void GetDefaultValueReturnsDefaultValueForAssociatedTypeCode()
        {
            foreach (TypeCode code in Enum.GetValues(typeof(TypeCode)))
            {
                if (code == TypeCode.Empty)
                {
                    continue;
                }

                Type associatedType = Type.GetType("System." + code);
                Assert.AreEqual(ReflectionUtils.GetDefaultValue(code), ReflectorTypeUtils.GetDefaultValue(Reflector.Wrap(associatedType)));
            }
        }
예제 #2
0
        public void GetTypeCodeReturnsExpectedCodeForAllBuiltInTypes()
        {
            foreach (TypeCode code in Enum.GetValues(typeof(TypeCode)))
            {
                if (code == TypeCode.Empty)
                {
                    continue;
                }

                Type associatedType = Type.GetType("System." + code);
                Assert.AreEqual(code, ReflectorTypeUtils.GetTypeCode(Reflector.Wrap(associatedType)));
            }
        }
예제 #3
0
 public void GetDefaultValueReturnsNullIfTypeIsNull()
 {
     Assert.IsNull(ReflectorTypeUtils.GetDefaultValue(null));
 }
예제 #4
0
 public void GetTypeCodeReturnsObjectByDefault()
 {
     Assert.AreEqual(TypeCode.Object, ReflectorTypeUtils.GetTypeCode(Reflector.Wrap(GetType())));
 }
예제 #5
0
 public void GetTypeCodeReturnsEmptyIfTypeIsNull()
 {
     Assert.AreEqual(TypeCode.Empty, ReflectorTypeUtils.GetTypeCode(null));
 }