Exemplo n.º 1
0
        internal static T Create <T>(IDefaultData defaultData, ObjectCreationStrategy objectCreationStrategy)
        {
            var type = typeof(T);

            return(type.IsInterface ?
                   (T)NonGenericInterfaceTypeCreator.GetValueOrDefault(type)?.Invoke(defaultData, objectCreationStrategy) :
                   (T)NonGenericTypeCreator.GetValueOrDefault(type)?.Invoke(defaultData, objectCreationStrategy));
        }
        internal static T Create <T>(Type expectedType)
        {
            var result = (T)NonGenericTypeCreator.GetValueOrDefault(expectedType)?.Invoke();

            if (result == null)
            {
                Debug.WriteLine($"Expected Enumerator type: '{expectedType.Name}' is unknown to create.");
            }
            return(result);
        }