private void AppendTests(XunitTestClassElement classElement, ITypeInfo typeInfo, IEnumerable <IDeclaredType> types) { foreach (var declaredType in types) { if (declaredType.GetClrName().Equals(PredefinedType.OBJECT_FQN)) { continue; } var typeElement = declaredType.GetTypeElement(); if (typeElement != null) { var methodInfo = new PsiMethodInfoAdapter(); foreach (var method in typeElement.GetMembers().OfType <IMethod>()) { methodInfo.Reset(method, typeInfo); if (MethodUtility.IsTest(methodInfo)) { var element = unitTestElementFactory.GetOrCreateTestMethod(project, classElement, typeElement.GetClrName(), method.ShortName, MethodUtility.GetSkipReason(methodInfo), methodInfo.GetTraits(), false); observer.OnUnitTestElementDisposition(UnitTestElementDisposition.NotYetClear(element)); } } } } }
private void OnUnitTestElement(IUnitTestElement element, IDeclaration declaration = null) { if (declaration == null) { _observer.OnUnitTestElementDisposition(UnitTestElementDisposition.NotYetClear(element)); return; } var project = declaration.GetSourceFile().ToProjectFile(); var textRange = declaration.GetNameDocumentRange().TextRange; var containingRange = declaration.GetDocumentRange().TextRange; var disposition = new UnitTestElementDisposition(element, project, textRange, containingRange); _observer.OnUnitTestElementDisposition(disposition); }
public UnitTestElementDisposition GetDispositionFromFiles(params ITestFile[] testFiles) { var declarations = testFiles .Select(x => x.TestDeclarations.Search(Identity, y => y.TestDeclarations)) .WhereNotNull().ToList(); var locations = declarations.Select(x => x.GetTestElementLocation()).ToList(); if (locations.Count != 0) { return(new UnitTestElementDisposition(locations, this)); } if (_state == UnitTestElementState.Dynamic || _state == UnitTestElementState.PendingDynamic) { return(UnitTestElementDisposition.NotYetClear(this)); } _state = UnitTestElementState.Invalid; return(UnitTestElementDisposition.InvalidDisposition); }