I do not want to completely disable warnings only when they are contained in the statement.
So for example, if I have the following two lines
var someObject = GetObject(); Assert.IsNotNull(someObject, "someObject should not be null"); Assert.AreEqual(expectedValue, someObject.SomeProperty);
I will get a possible null reference warning in the second line of someObject.SomeProperty
. Is it possible to disable a warning when it is within a specific call, for example Assert.AreEqual
?
Since this is a problem with a lot of unit tests, I donβt want to hush up the tests with the ReSharper disconnect code.
Currently, the only option I can think of is to change each call to Assert.IsNotNull
var someObject = GetObject(); if(someObject == null) { Assert.Fail("someObject is null"); return; }
Although this view seems to be aimed at having Assert.IsNotNull
in the first place. Just wondering if there is a better way.
source share