machine / machine.specifications

Machine.Specifications is a Context/Specification framework for .NET that removes language noise and simplifies tests.
MIT License
885 stars 178 forks source link

Resharper displaying unused warnings #405

Closed derekgreer closed 4 years ago

derekgreer commented 4 years ago

I'm using MSpec V 1.0.0 with Resharper 2019.3. I have the following example spec:

    [Subject("test")]
    public class when_anything
    {
        private Establish context;

        private Because of;

        private It should_succeed = () => true.ShouldBeFalse();

        private It should_succeed2 = () => true.ShouldBeTrue();
    }

Each of the members is triggering an 'unused' warning and is greyed out except for the class name. Shouldn't the use of the [Subject] attribute be flagging the members as implicitly used? It's definitely getting picked up for the class name.

robertcoltheart commented 4 years ago

This is an issue with the latest ReSharper and isn't related to Mspec as far as I can tell. Also VS is much tougher with disallowing unused warning suppression via code (you can see this in the lighter shading of the text color), which is how Mspec does it. I'd suggest raising an issue with JetBrains regarding their custom annotations and how they suppress unused warnings.