Skip to content

Commit

Permalink
Merge pull request #41 from mikkelbu/return-if-no-TestCaseAttribute-c…
Browse files Browse the repository at this point in the history
…an-be-found

Only examine TestCaseAttribute if reference to NUnit exists
  • Loading branch information
mikkelbu authored May 15, 2018
2 parents 96e5989 + 42ce10d commit 741196c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/nunit.analyzers/TestCaseUsage/TestCaseUsageAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ private static void AnalyzeAttribute(SyntaxNodeAnalysisContext context)
var attributeSymbol = context.SemanticModel.GetSymbolInfo(attributeNode).Symbol;
var testCaseType = context.SemanticModel.Compilation.GetTypeByMetadataName(NunitFrameworkConstants.FullNameOfTypeTestCaseAttribute);

if (testCaseType == null)
return;

if (testCaseType.ContainingAssembly.Identity == attributeSymbol?.ContainingAssembly.Identity &&
NunitFrameworkConstants.NameOfTestCaseAttribute == attributeSymbol?.ContainingType.Name)
{
Expand Down

0 comments on commit 741196c

Please sign in to comment.