-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick fix for Wrong Test method with last Nunit3TestAdapter #57 #58
Conversation
@@ -31,10 +44,15 @@ private static bool HasPdb(MethodBase methodBase) | |||
lock (Lock) | |||
{ | |||
if (AssemblyHasPdbCache.TryGetValue(location, out var hasPdb)) return hasPdb; | |||
hasPdb = File.Exists(Path.ChangeExtension(location, ".pdb")); | |||
hasPdb = IsNotATestFrameworkAssembly(methodBase.DeclaringType.Assembly) && File.Exists(Path.ChangeExtension(location, ".pdb")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename hasPdb to isUserAssembly. Or something different.
Not a blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was thinking the same
|
||
private static bool IsNotATestFrameworkAssembly(Assembly assembly) | ||
{ | ||
return !TestFrameworkAssemblies.Any(framework => assembly.GetName().Name.Equals(framework, StringComparison.InvariantCultureIgnoreCase)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this method might be called several times in some situations, maybe it's better to use a Hashset and lose the IgnoreCase comparison. O(1) vs O(n)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
AssemblyHasPdbCache.Add(location, hasPdb); | ||
return hasPdb; | ||
} | ||
} | ||
|
||
private static bool IsNotATestFrameworkAssembly(Assembly assembly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I slightly prefer a positive method: IsTestFrameworkAssembly
And negate where we call the method.
But this is not a blocker.
As I wrote it in the issue we should do a small instrumentation on Test assemblies that would add an attribute on hit so that we don't need to know tests frameworks
Also would improve execution as then we don't need to instrument every thing with the try catch only the Test assemblies