You do not need to use SubjectAttribute to recognize the contexts and specifications of ReSharper, just the class containing the It field is enough. However, if you want ReSharper to support custom naming conventions for MSpec types and fields ( Because et al), you need to use SubjectAttribute :
Define User Naming Conventions in ReSharper | Options | Languages ββ/ General Section | Naming Style | Advanced settings
When adding a custom naming rule, scroll down to see MSpec objects.
Enable MSpec Annotations in ReSharper | Options | Code Verification / Annotation Code Section
Annotations + SubjectAttribute (even without custom naming rules) prevent ReSharper from marking MSpec fields as unused. Alternatively, turn off warning 169 in the project settings.
Subject serves as metadata that describes your context, for example, you can use the System Under Test (when writing a unit test), a string of your choice, or both. This information will be presented in HTML and in the output of ReSharper. This does not work at the moment, I suspect that this is a bug in the ReSharper runner for 6.0.
As with strings, you can put whatever you want. I would recommend using a theme to group my feature specifications.
Subject: Login
Contexts: when logging in with valid credentials, when logging in with invalid credentials, etc.
There is a GitHub in my repository .
Alexander GroΓ
source share