internal static string GetMethodDescription(this MethodInfo @this, SortedSet <string> namespaces, bool includeOverride, RequiresExplicitInterfaceImplementation requiresExplicitInterfaceImplementation) { if (@this.IsGenericMethod) { @this = @this.GetGenericMethodDefinition(); } @this.ReturnType.AddNamespaces(namespaces); var isOverride = includeOverride ? (@this.DeclaringType.IsClass ? "override " : string.Empty) : string.Empty; var returnType = @this.ReturnType == typeof(void) ? "void" : $"{@this.ReturnType.GetFullName(namespaces, @this.ReturnParameter)}"; var methodName = @this.Name; var generics = string.Empty; var constraints = string.Empty; if (@this.IsGenericMethodDefinition) { (generics, constraints) = @this.GetGenericArguments(namespaces); constraints = constraints.Length == 0 ? string.Empty : $" {constraints}"; } var parameters = @this.GetParameters(namespaces); var explicitInterfaceName = requiresExplicitInterfaceImplementation == RequiresExplicitInterfaceImplementation.Yes ? $"{@this.DeclaringType.GetFullName(namespaces)}." : string.Empty; return($"{isOverride}{returnType} {explicitInterfaceName}{methodName}{generics}({parameters}){constraints}"); }
internal PropertyMockableResult(PropertyInfo value, RequiresExplicitInterfaceImplementation requiresExplicitInterfaceImplementation, PropertyAccessors accessors) : base(value, requiresExplicitInterfaceImplementation) => this.Accessors = accessors;
internal MethodMockableResult(MethodInfo value, RequiresExplicitInterfaceImplementation requiresExplicitInterfaceImplementation, RequiresIsNewImplementation requiresIsNewImplementation) : base(value, requiresExplicitInterfaceImplementation) => this.RequiresNewImplementation = requiresIsNewImplementation;
internal MockableResult(T value, RequiresExplicitInterfaceImplementation requiresExplicitInterfaceImplementation) => (this.Value, this.RequiresExplicitInterfaceImplementation) = (value, requiresExplicitInterfaceImplementation);
internal static string GetMethodDescription(this MethodInfo @this, SortedSet<string> namespaces, bool includeOverride, RequiresExplicitInterfaceImplementation requiresExplicitInterfaceImplementation) { if (@this.IsGenericMethod) { @this = @this.GetGenericMethodDefinition(); } @this.ReturnType.AddNamespaces(namespaces); var isOverride = includeOverride ? (@this.DeclaringType.IsClass ? "override " : string.Empty) : string.Empty; var returnType = @this.ReturnType == typeof(void) ? "void" : $"{@this.ReturnType.GetFullName(namespaces)}"; var methodName = @this.Name; var generics = string.Empty; var constraints = string.Empty; if (@this.IsGenericMethodDefinition) { var result = @this.GetGenericArguments(namespaces); generics = result.Arguments; constraints = result.Constraints.Length == 0 ? string.Empty : $" {result.Constraints}"; } var parameters = @this.GetParameters(namespaces); var explicitInterfaceName = requiresExplicitInterfaceImplementation == RequiresExplicitInterfaceImplementation.Yes ? $"{@this.DeclaringType.GetFullName(namespaces)}." : string.Empty; return $"{isOverride}{returnType} {explicitInterfaceName}{methodName}{generics}({parameters}){constraints}"; }