Summary

Class:FakeXrmEasy.Extensions.TypeExtensions
Assembly:FakeXrmEasy
File(s):C:\code\jordimontana82\fake-xrm-easy\FakeXrmEasy.Shared\Extensions\TypeExtensions.cs
Covered lines:15
Uncovered lines:6
Coverable lines:21
Total lines:41
Line coverage:71.4%
Branch coverage:100%

Metrics

MethodCyclomatic ComplexitySequence CoverageBranch Coverage
IsOptionSet(...)5100100
IsDateTime(...)4100100
IsNullableEnum(...)300
IsOptionSetValueCollection(...)1100100

File(s)

C:\code\jordimontana82\fake-xrm-easy\FakeXrmEasy.Shared\Extensions\TypeExtensions.cs

#LineLine coverage
 1using Microsoft.Xrm.Sdk;
 2using System;
 3using System.Collections.Generic;
 4using System.Reflection;
 5
 6namespace FakeXrmEasy.Extensions
 7{
 8    public static class TypeExtensions
 9    {
 10        public static bool IsOptionSet(this Type t)
 628011        {
 628012            var nullableType = Nullable.GetUnderlyingType(t);
 628013             return t == typeof(OptionSetValue)
 628014                   || t.IsEnum
 628015                   || nullableType != null && nullableType.IsEnum;
 628016        }
 17
 18#if FAKE_XRM_EASY_9
 19        public static bool IsOptionSetValueCollection(this Type t)
 17820        {
 17821            var nullableType = Nullable.GetUnderlyingType(t);
 17822            return t == typeof(OptionSetValueCollection);
 17823        }
 24#endif
 25
 26        public static bool IsDateTime(this Type t)
 171527        {
 171528            var nullableType = Nullable.GetUnderlyingType(t);
 171529            return t == typeof(DateTime)
 171530                   || nullableType != null && nullableType == typeof(DateTime);
 171531        }
 32
 33        public static bool IsNullableEnum(this Type t)
 034        {
 035            return
 036                t.IsGenericType
 037                && t.GetGenericTypeDefinition() == typeof(Nullable<>)
 038                && t.GetGenericArguments()[0].IsEnum;
 039        }
 40    }
 41}