private async Task <FeatureTestResult> RunTestAsync(MethodInfo test, Type adapterType, IEnumerable <FeatureTestRun> dependencies) { var specialCase = this.GetSpecialCase(test, adapterType) ?? this.GetSpecialCase(test.DeclaringType, adapterType); if (specialCase != null && specialCase.Skip) { return(new FeatureTestResult(FeatureTestResultKind.SkippedDueToSpecialCase, this.attributeCleaner.CleanWhitespace(specialCase.Comment))); } foreach (var dependency in dependencies.OrderBy(d => d.Method.Name)) { var result = await dependency.Task; if (result.Kind != FeatureTestResultKind.Success) { var className = FeatureTestAttributeHelper.GetDisplayName(dependency.Method.DeclaringType); var testName = FeatureTestAttributeHelper.GetDisplayName(dependency.Method); var skippedComment = string.Format("Skipped as {0} ({1}) is not supported by this library.", testName, className); return(new FeatureTestResult(FeatureTestResultKind.SkippedDueToDependency, skippedComment)); } } var instance = Activator.CreateInstance(test.DeclaringType); using (instance as IDisposable) { try { await Task.Run(() => test.Invoke(instance, new object[] { LibraryProvider.CreateAdapter(adapterType) })); } catch (Exception ex) { var useful = ToUsefulException(ex); if (useful is SkipException) { return(new FeatureTestResult(FeatureTestResultKind.SkippedDueToSpecialCase, useful.Message)); } return(new FeatureTestResult(FeatureTestResultKind.Failure, exception: useful)); } } var comment = specialCase != null?this.attributeCleaner.CleanWhitespace(specialCase.Comment) : null; return(new FeatureTestResult(FeatureTestResultKind.Success, comment)); }