7

I have a project with several large test cases in it and the project takes about 2-3 minutes to build. I am suspicious that it has to do with this new warnings feature... for example:

warning xUnit2003: Do not use Assert.Equal()
warning xUnit2004: Do not use Assert.Equal() to check for boolean conditions.

It is doing this for thousands of lines...

It would be great if there was a way to disable this feature. Not sure if it has to do with the visual studio runner or xunit itself.

Julian
  • 33,915
  • 22
  • 119
  • 174
Blake Rivell
  • 13,105
  • 31
  • 115
  • 231
  • 3
    How about fixing your unit tests and using `Assert.IsTrue` and `Assert.IsFalse` instead? – Tseng Jun 14 '17 at 14:26
  • 3
    Technical debt has a way of calling in the loan. You need to fix the tests. The warnings are there for a reason. – Nkosi Jun 14 '17 at 15:05

1 Answers1

6

You could disable the warnings as follows:

  • for a file

    #pragma warning disable xUnit2003, xUnit2004
    

    optionally restore them:

    #pragma warning restore xUnit2003, xUnit2004
    

Or in your project properties:

enter image description here

Julian
  • 33,915
  • 22
  • 119
  • 174