سؤال

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?

هل كانت مفيدة؟

المحلول

There are two solutions:

  1. Make the field non private.
  2. Disable that warning in your test project.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top