This is a migrated thread and some comments may be shown as answers.

How to disable the "Unused Method" warning for unit tests

2 Answers 534 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Calvin
Top achievements
Rank 2
Calvin asked on 02 Apr 2012, 05:21 PM
Hi,

JustCode lists warnings for all of my xUnit test methods (annotated with xUnit's [Fact] attribute) indicating that each method is an "unused method". But since these are test methods, they won't get used elsewhere.  Consequently, I regard these JC warnings as a false positives.

Is there a way to globally disable these warnings (but only for the test methods)?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Yanaki Yanakiev
Telerik team
answered on 04 Apr 2012, 05:07 PM
Hello Calvin,

You can't disable the warning only for the test methods. You can hide all warnings for "Unused private members" by setting the option to "Do not show" in JustCode -> Options -> Code analysis -> Warnings -> C#.
We will work on improving JustCode analysis in such cases and I added a  PITS item where you can monitor our progress. I added some telerik points to your account for the heads up on this issue.


All the best,
Yanaki Yanakiev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Kevin Babcock
Top achievements
Rank 1
answered on 18 Jun 2012, 06:48 PM
It would be nice to add some kind of "SuppressMessage" attribute we can add to a global class to prevent JustCode displaying warnings/errors for specific code.

I added my comment to the PITS item.
Tags
General Discussions
Asked by
Calvin
Top achievements
Rank 2
Answers by
Yanaki Yanakiev
Telerik team
Kevin Babcock
Top achievements
Rank 1
Share this question
or