public static void AssertDelegate <T, TDelegate>(this StructureTest test, params ITypeVerifier[] verifiers) where TDelegate : Delegate { ITypeVerifier[] additionalVerifiers = new ITypeVerifier[] { new TypeIsDelegateVerifier(), new DelegateSignatureVerifier(typeof(TDelegate)) }; ITypeVerifier[] allVerifiers = verifiers.Union(additionalVerifiers).ToArray(); test.AssertType(typeof(T), allVerifiers); }
public static void AssertInterface <T>(this StructureTest test, params ITypeVerifier[] verifiers) { ITypeVerifier[] allVerifiers = verifiers.Union(new[] { new TypeIsInterfaceVerifier() }).ToArray(); test.AssertType(typeof(T), allVerifiers); }
// Design note, methods with qualifiers (like public & abstract) should not be extendable // and instead the methods without qualifiers should be used. This is done in an effort to avoid // StructureTest.AssertPublicClass<T>(new TypeIsAbstract()) and // StructureTest.AssertAbstractClass<T>(new TypeAccessLevel(AccessLevel.Public)), // which are fully equavilent however look different. public static void AssertClass(this StructureTest test, Type type, params ITypeVerifier[] verifiers) { test.AssertType(type, verifiers); }