IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Helper methods for inspecting a type by reflection. More...
Classes | |
class | BaseTypesFirstComparer |
Static Public Member Functions | |
static MethodInfo[] | GetMethodsWithAttribute (Type fixtureType, Type attributeType, bool inherit) |
Examine a fixture type and return an array of methods having a particular attribute. The array is order with base methods first. More... | |
static bool | HasMethodWithAttribute (Type fixtureType, Type attributeType) |
Examine a fixture type and return true if it has a method with a particular attribute. More... | |
static object | Construct (Type type) |
Invoke the default constructor on a Type More... | |
static object | Construct (Type type, object[] arguments) |
Invoke a constructor on a Type with arguments More... | |
static object | InvokeMethod (MethodInfo method, object fixture) |
Invoke a parameterless method returning void on an object. More... | |
static object | InvokeMethod (MethodInfo method, object fixture, params object[] args) |
Invoke a method, converting any TargetInvocationException to an NUnitException. More... | |
Static Private Member Functions | |
static Type[] | GetTypeArray (object[] objects) |
Returns an array of types from an array of objects. Used because the compact framework doesn't support Type.GetTypeArray() More... | |
Static Private Attributes | |
static readonly BindingFlags | AllMembers = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static |
static readonly Type[] | EmptyTypes = new Type[0] |
Helper methods for inspecting a type by reflection.
Many of these methods take ICustomAttributeProvider as an argument to avoid duplication, even though certain attributes can only appear on specific types of members, like MethodInfo or Type.
In the case where a type is being examined for the presence of an attribute, interface or named member, the Reflect methods operate with the full name of the member being sought. This removes the necessity of the caller having a reference to the assembly that defines the item being sought and allows the NUnit core to inspect assemblies that reference an older version of the NUnit framework.
|
inlinestatic |
Examine a fixture type and return an array of methods having a particular attribute. The array is order with base methods first.
fixtureType | The type to examine |
attributeType | The attribute Type to look for |
inherit | Specifies whether to search the fixture type inheritance chain |
Referenced by NUnit.Framework.Internal.Execution.CommandBuilder.BuildSetUpTearDownList(), and NUnit.Framework.Internal.TestSuite.CheckSetUpTearDownMethods().
|
inlinestatic |
Examine a fixture type and return true if it has a method with a particular attribute.
fixtureType | The type to examine |
attributeType | The attribute Type to look for |
Referenced by NUnit.Framework.Internal.TypeWrapper.HasMethodWithAttribute().
|
inlinestatic |
Invoke the default constructor on a Type
type | The Type to be constructed |
Referenced by NUnit.Framework.Internal.TypeWrapper.Construct(), NUnit.Framework.Attributes.DerivedPropertyAttributeTests.ConstructWithNoArgs< T >(), NUnit.Framework.Attributes.DerivedPropertyAttributeTests.ConstructWithOneArg< T >(), NUnit.Framework.Api.FrameworkController.FrameworkController(), NUnit.Framework.ValueSourceAttribute.GetDataSource(), NUnit.Framework.Internal.Builders.ProviderCache.GetInstanceOf(), NUnit.Framework.TestCaseSourceAttribute.GetTestCaseSource(), NUnit.Framework.TestFixtureSourceAttribute.GetTestFixtureSource(), NUnit.TestUtilities.TestAssert.IsRunnable(), NUnit.Framework.Attributes.RepeatAttributeTests.RepeatWorksAsExpected(), NUnit.Framework.Attributes.RetryAttributeTests.RetryWorksAsExpected(), NUnit.TestUtilities.TestBuilder.RunParameterizedMethodSuite(), and NUnit.TestUtilities.TestBuilder.RunTestCase().
|
inlinestatic |
Invoke a constructor on a Type with arguments
type | The Type to be constructed |
arguments | Arguments to the constructor |
|
inlinestaticprivate |
Returns an array of types from an array of objects. Used because the compact framework doesn't support Type.GetTypeArray()
objects | An array of objects |
|
inlinestatic |
Invoke a parameterless method returning void on an object.
method | A MethodInfo for the method to be invoked |
fixture | The object on which to invoke the method |
Referenced by NUnit.Framework.Internal.MethodWrapper.Invoke(), and NUnit.Framework.Internal.Commands.SetUpTearDownItem.RunNonAsyncMethod().
|
inlinestatic |
Invoke a method, converting any TargetInvocationException to an NUnitException.
method | A MethodInfo for the method to be invoked |
fixture | The object on which to invoke the method |
args | The argument list for the method |
|
staticprivate |
|
staticprivate |