How should I respond to "Field is never used" warnings?

In the following VB.NET unit test, Resharper warns me that _presenter is never used, and gives me the option to remove it or comment it out. Doing so would be a mistake, however, since _presenter is critical to the operation of this MVP pattern.

  Public Class RangeSliderTest

    Private ReadOnly _model As New RangeSliderModel
    Private ReadOnly _mockView As New Mock(Of IRangeSliderView)
    Private ReadOnly _presenter As New RangeSliderPresenter(_model, _mockView.Object)

    <Test()> _
    Public Sub CanChangeRangeMin()
      _model.RangeMin = 99
      _mockView.Verify(Sub(x) x.UpdateRangeMin(), Times.Once)
    End Sub

  End Class

I'm trying to achieve warning-free code, so I need to decide how to deal with this warning. My options are:
1) Disable Resharper's "Type or type member is never used" inspection.
2) Treat this particular violation as a special case and disable the Resharper warning with comments.
3) Recognize that the warning identifies a legitimate coding mispractice, and adjust my code accordingly (but how?).

Is this issue familiar to the Resharper community? If so, how do others deal with it?


Please sign in to leave a comment.