Skip to content
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

New rule to ensure that base class TestFixtures are abstract. #848

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manfred-brands
Copy link
Member

Fixes #840

I've run this against the nunit.framework code where it raised 2 errors:

  • NUnit.Framework.Tests.Attributes.ThreadingTests has 10 derived fixtures.
  • NUnit.Framework.Tests.Attributes.BaseRepeatableTestFixture has 2 derived fixtures, although this might be intentional.

Copy link
Member

@mikkelbu mikkelbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit-pick - we usually add the documentation files to the solution file otherwise this looks good and I'm happy to merge it when you are

if (!modifiers.Any())
{
// Get leading trivia from declaration
abstractSyntax = abstractSyntax.WithLeadingTrivia(originalExpression.GetLeadingTrivia());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add this case to the TestFixtureShouldBeAbstractCodeFixTests.cs (or parameterise the existing test even more)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect incorrect or questionable use of TestFixture inheritance.
2 participants