1

I'm using Fake.InitializeFixture like this:

[Fake] private ISomeDependency _someDependency;
[UnderTest] private SomethingToTest _somethingToTest;

[SetUp]
public void SetUp()
{
    Fake.InitializeFixture(this);
}

...

It works fine when running the tests, but the problem is that Visual Studio gives me these warnings:

Warning 27 Field '...._someDependency' is never assigned to, and will always have its default value null

I would like to have zero warnings when compiling. Is there any way to get rid of these?

Allrameest
  • 4,364
  • 2
  • 34
  • 50

1 Answers1

2

There are two solutions:

  1. Make the field non private.
  2. Disable that warning in your test project.
Patrik Hägne
  • 16,751
  • 5
  • 52
  • 60
  • How do I disable that warning for a project? I've only managed to suppress FxCop warnings. I've tried both `/nowarn:649` and `[assembly: SuppressMessage("", "CS0649")]`. `#pragma warning disable 0649` works, but not project wide. – Allrameest Sep 13 '12 at 19:19
  • 1
    To disable for the test project open project Properties, go to the Build tab and enter the code 0649 in the Suppress Warnings box. – 9swampy Sep 09 '14 at 23:07