Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MSTEST0012/MSTEST0013 documentation about test class being static #44431

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/core/testing/mstest-analyzers/mstest0012.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,19 @@ A method marked with `[AssemblyInitialize]` should have valid layout.

Methods marked with `[AssemblyInitialize]` should follow the following layout to be valid:

- it can't be declared on a generic class
- it should be `public`
- it should be `static`
- it should not be `async void`
- it should not be a special method (finalizer, operator...).
- it should not be generic
- it should not be abstract
- it should take one parameter of type `TestContext`
- return type should be `void`, `Task` or `ValueTask`

The type declaring these methods should also respect the following rules:

- The type should be a class.
- The class should be public or internal (if the test project is using the [DiscoverInternals] attribute).
- The class shouldn't be static.
- The class should be marked with [TestClass] (or a derived attribute)
- the class should not be generic

Expand Down
3 changes: 1 addition & 2 deletions docs/core/testing/mstest-analyzers/mstest0013.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,19 @@ A method marked with `[AssemblyCleanup]` should have valid layout.

Methods marked with `[AssemblyCleanup]` should follow the following layout to be valid:

- it can't be declared on a generic class
- it should be `public`
- it should be `static`
- it should not be `async void`
- it should not be a special method (finalizer, operator...).
- it should not be generic
- it should not be abstract
- it should not take any parameter, or starting with MSTest 3.8, it can have a single `TestContext` parameter
- return type should be `void`, `Task` or `ValueTask`

The type declaring these methods should also respect the following rules:

- The type should be a class.
- The class should be public or internal (if the test project is using the [DiscoverInternals] attribute).
- The class shouldn't be static.
- The class should be marked with [TestClass] (or a derived attribute)
- the class should not be generic

Expand Down
Loading