private void ExploreType(IProject project, IMetadataAssembly assembly, UnitTestElementConsumer consumer, IMetadataTypeInfo metadataTypeInfo) { // It would be nice to use TestClassCommandFactory.Make(...), but that doesn't work // with RunWith, since Make ends up calling TypeUtility.GetRunWith, which tries to // call IAttributeInfo.GetInstance<RunWithAttribute>, and we can't support that. // So we'll break down Make and do it ourselves. If the runner finds any methods // that we don't find, it will create them at runtime var typeInfo = metadataTypeInfo.AsTypeInfo(); if (TypeUtility.IsTestClass(typeInfo)) ExploreTestClass(project, assembly, consumer, typeInfo, metadataTypeInfo.FullyQualifiedName); }
private void ProcessTypeInfo(IMetadataTypeInfo metadataTypeInfo) { ITypeInfo typeInfo = metadataTypeInfo.AsTypeInfo(); // TODO: What about HasRunWith support? Not supported in previous R# versions if (!UnitTestElementMetadataIdentifier.IsUnitTestContainer(metadataTypeInfo)) return; ITestClassCommand testClassCommand = TestClassCommandFactory.Make(typeInfo); if (testClassCommand == null) return; ProcessTestClass(new ClrTypeName(metadataTypeInfo.FullyQualifiedName), testClassCommand.EnumerateTestMethods(), GetParentClassElement(metadataTypeInfo)); }
private void ExploreType(IProject project, IMetadataAssembly assembly, IUnitTestElementsObserver observer, IMetadataTypeInfo metadataTypeInfo) { // It would be nice to use TestClassCommandFactory.Make(...), but that doesn't work // with RunWith, since Make ends up calling TypeUtility.GetRunWith, which tries to // call IAttributeInfo.GetInstance<RunWithAttribute>, and we can't support that. // So we'll break down Make and do it ourselves. If the runner finds any methods // that we don't find, it will create them at runtime var typeInfo = metadataTypeInfo.AsTypeInfo(); if (TypeUtility.IsTestClass(typeInfo)) { ExploreTestClass(project, assembly, observer, typeInfo, metadataTypeInfo.FullyQualifiedName); } }
public static bool IsUnitTestContainer(IMetadataTypeInfo metadataTypeInfo) { return IsPublic(metadataTypeInfo) && TypeUtility.IsTestClass(metadataTypeInfo.AsTypeInfo()); }
private static bool IsDirectUnitTestClass(IMetadataTypeInfo metadataTypeInfo) { return IsExportedType(metadataTypeInfo) && TypeUtility.IsTestClass(metadataTypeInfo.AsTypeInfo()); }