Skip to content

Commit

Permalink
Replace IsNullableType for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
cwinland committed May 31, 2022
1 parent 01ad6a8 commit d05b4a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion FastMoq/Mocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,14 @@ internal static bool IsValidConstructor(ConstructorInfo info, params object?[] i
{
var paramType = paramList[i].ParameterType;
var instanceType = instanceParameterValues[i]?.GetType();
isValid &= (instanceType == null && paramType.IsNullableType()) || (instanceType != null && paramType.IsAssignableFrom(instanceType));
isValid &= (instanceType == null && IsNullableType(paramType)) || (instanceType != null && paramType.IsAssignableFrom(instanceType));
}

return isValid;

}

internal static bool IsNullableType(Type type) => type.IsGenericType && type.GetGenericTypeDefinition() == typeof (Nullable<>);
internal static bool IsMockFileSystem<T>(bool usePredefinedFileSystem) => usePredefinedFileSystem && (typeof(T) == typeof(IFileSystem) || typeof(T) == typeof(FileSystem));
internal static void ThrowAlreadyExists(Type type) => throw new ArgumentException($"{type} already exists.");
}
Expand Down

0 comments on commit d05b4a2

Please sign in to comment.