-
Notifications
You must be signed in to change notification settings - Fork 727
/
IMethodInfo.cs
98 lines (79 loc) · 3.12 KB
/
IMethodInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
using System;
using System.Reflection;
namespace NUnit.Framework.Interfaces
{
/// <summary>
/// The IMethodInfo class is used to encapsulate information
/// about a method in a platform-independent manner.
/// </summary>
public interface IMethodInfo : IReflectionInfo
{
#region Properties
/// <summary>
/// Gets the Type from which this method was reflected.
/// </summary>
ITypeInfo TypeInfo { get; }
/// <summary>
/// Gets the MethodInfo for this method.
/// </summary>
MethodInfo MethodInfo { get; }
/// <summary>
/// Gets the name of the method.
/// </summary>
string Name { get; }
/// <summary>
/// Gets a value indicating whether the method is abstract.
/// </summary>
bool IsAbstract { get; }
/// <summary>
/// Gets a value indicating whether the method is public.
/// </summary>
bool IsPublic { get; }
/// <summary>
/// Gets a value indicating whether the method is static.
/// </summary>
bool IsStatic { get; }
/// <summary>
/// Gets a value indicating whether the method contains unassigned generic type parameters.
/// </summary>
bool ContainsGenericParameters { get; }
/// <summary>
/// Gets a value indicating whether the method is a generic method.
/// </summary>
bool IsGenericMethod { get; }
/// <summary>
/// Gets a value indicating whether the MethodInfo represents the definition of a generic method.
/// </summary>
bool IsGenericMethodDefinition { get; }
/// <summary>
/// Gets the return Type of the method.
/// </summary>
ITypeInfo ReturnType { get; }
#endregion
#region Methods
/// <summary>
/// Gets the parameters of the method.
/// </summary>
/// <returns></returns>
IParameterInfo[] GetParameters();
/// <summary>
/// Returns the Type arguments of a generic method or the Type parameters of a generic method definition.
/// </summary>
Type[] GetGenericArguments();
/// <summary>
/// Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo.
/// </summary>
/// <param name="typeArguments">The type arguments to be used</param>
/// <returns>A new IMethodInfo with the type arguments replaced</returns>
IMethodInfo MakeGenericMethod(params Type[] typeArguments);
/// <summary>
/// Invokes the method, converting any TargetInvocationException to an NUnitException.
/// </summary>
/// <param name="fixture">The object on which to invoke the method</param>
/// <param name="args">The argument list for the method</param>
/// <returns>The return value from the invoked method</returns>
object? Invoke(object? fixture, params object?[]? args);
#endregion
}
}