private Test TryGetTypeTest(ITypeInfo type, Test assemblyTest) { Test typeTest; if (!typeTests.TryGetValue(type, out typeTest)) { try { XunitTypeInfoAdapter xunitTypeInfo = new XunitTypeInfoAdapter(type); ITestClassCommand command = TestClassCommandFactory.Make(xunitTypeInfo); if (command != null) { typeTest = CreateTypeTest(xunitTypeInfo, command); } } catch (Exception ex) { TestModel.AddAnnotation(new Annotation(AnnotationType.Error, type, "An exception was thrown while exploring an xUnit.net test type.", ex)); } if (typeTest != null) { assemblyTest.AddChild(typeTest); typeTests.Add(type, typeTest); } } return(typeTest); }
protected override void ExploreImpl(IReflectionPolicy reflectionPolicy, ICodeElementInfo codeElement) { IAssemblyInfo assembly = ReflectionUtils.GetAssembly(codeElement); Version frameworkVersion = GetFrameworkVersion(assembly); if (frameworkVersion != null) { ITypeInfo type = ReflectionUtils.GetType(codeElement); Test assemblyTest = GetAssemblyTest(assembly, TestModel.RootTest, frameworkVersion, type == null); if (type != null) { TryGetTypeTest(type, assemblyTest); } } }
private Test TryGetTypeTest(ITypeInfo type, Test assemblyTest) { Test typeTest; if (!typeTests.TryGetValue(type, out typeTest)) { try { XunitTypeInfoAdapter xunitTypeInfo = new XunitTypeInfoAdapter(type); ITestClassCommand command = TestClassCommandFactory.Make(xunitTypeInfo); if (command != null) typeTest = CreateTypeTest(xunitTypeInfo, command); } catch (Exception ex) { TestModel.AddAnnotation(new Annotation(AnnotationType.Error, type, "An exception was thrown while exploring an xUnit.net test type.", ex)); } if (typeTest != null) { assemblyTest.AddChild(typeTest); typeTests.Add(type, typeTest); } } return typeTest; }