示例#1
0
 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);
 }
示例#2
0
 public static void AssertInterface <T>(this StructureTest test, params ITypeVerifier[] verifiers)
 {
     ITypeVerifier[] allVerifiers = verifiers.Union(new[] { new TypeIsInterfaceVerifier() }).ToArray();
     test.AssertType(typeof(T), allVerifiers);
 }
示例#3
0
        // 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);
        }