Warnings when using Fake.InitializeFixture
-
01-07-2021 - |
سؤال
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:
- Make the field non private.
- Disable that warning in your test project.
لا تنتمي إلى StackOverflow