IsValueType() static private method

static private IsValueType ( Type type ) : bool
type System.Type
return bool
示例#1
0
        public ComparisonResult Compare(IComparisonContext context, object value1, object value2)
        {
            var type1 = value1.GetType();

            if (IsSkipped(type1))
            {
                return(ComparisonResult.Inconclusive);
            }

            if (value1.Equals(value2))
            {
                return(ComparisonResult.Pass);
            }

            if (ReflectionCache.IsValueType(type1))
            {
                context.AddDifference(value1, value2);
                return(ComparisonResult.Fail);
            }

            return(ComparisonResult.Inconclusive);
        }
示例#2
0
        public (ComparisonResult result, IComparisonContext context) Compare(IComparisonContext context, object value1, object value2)
        {
            var type1 = value1.GetType();
            var type2 = value2.GetType();

            if (IsSkipped(type1) || IsSkipped(type2))
            {
                return(ComparisonResult.Inconclusive, context);
            }

            if (type1 != type2)
            {
                if (CoerceValues(ref value1, ref value2))
                {
                    type1 = value1.GetType();
                    type2 = value2.GetType();

                    if (type1 != type2)
                    {
                        return(ComparisonResult.Inconclusive, context);
                    }
                }
            }

            if (value1.Equals(value2))
            {
                return(ComparisonResult.Pass, context);
            }

            if (ReflectionCache.IsValueType(type1))
            {
                return(ComparisonResult.Fail, context.AddDifference(value1, value2));
            }

            return(ComparisonResult.Inconclusive, context);
        }