Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
Is it optional to include [TestFixture] attribute to unit test class in C#. I can see that with or without it the unit tests are running fine. Will it make differnce if it is excluded?

Please clarify

What I have tried:

Tried running the unit tests with and wiht out the attribute, unable to find any difference
Posted
Updated 25-Jul-16 1:13am

1 solution

Assuming you're using NUnit 2.5 or higher:

Beginning with NUnit 2.5, the TestFixture attribute is optional for non-parameterized, non-generic fixtures, so long as the class contains at least one method marked with the Test, TestCase or TestCaseSource attribute.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900