Skip to content

Commit

Permalink
chore: Correct markdown files to at most 120 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelbu authored Nov 19, 2023
1 parent f36e616 commit e185aaa
Show file tree
Hide file tree
Showing 87 changed files with 381 additions and 209 deletions.
9 changes: 6 additions & 3 deletions documentation/NUnit1001.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

## Description

The individual arguments provided by a TestCaseAttribute must match the type of the corresponding parameter of the method.
The individual arguments provided by a TestCaseAttribute must match the type of the corresponding parameter of the
method.

## Motivation

Expand All @@ -32,7 +33,8 @@ public void SampleTest(int numberValue)

### Problem

In the test case above, `true` in the test case indicates that `numberValue` should be a boolean. However, the test declares that `numberValue` is an integer. This will lead to a runtime failure.
In the test case above, `true` in the test case indicates that `numberValue` should be a boolean. However, the test
declares that `numberValue` is an integer. This will lead to a runtime failure.

### Fix

Expand Down Expand Up @@ -65,7 +67,8 @@ public void SampleTest(int numberValue)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
12 changes: 8 additions & 4 deletions documentation/NUnit1002.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The TestCaseSource should use nameof operator to specify target.

## Motivation

Prevent test rot by ensuring that future renames don't accidentally break tests in an unexpected way. `nameof` adds some compile-time support in these situations.
Prevent test rot by ensuring that future renames don't accidentally break tests in an unexpected way. `nameof` adds some
compile-time support in these situations.

## How to fix violations

Expand All @@ -37,11 +38,13 @@ public static object[] MyTestSource()

### Problem

In this case, we're referring to `"MyTestSource"` as a string directly. This is brittle; should the name of the property change, the test case source would become invalid, and we would not know this until executing tests.
In this case, we're referring to `"MyTestSource"` as a string directly. This is brittle; should the name of the property
change, the test case source would become invalid, and we would not know this until executing tests.

### Fix

The fix is to use the C# `nameof` operator, which produces a string but references the field name. This way, when refactoring and changing the name of your test source, it would also update the name within the `nameof()` operator.
The fix is to use the C# `nameof` operator, which produces a string but references the field name. This way, when
refactoring and changing the name of your test source, it would also update the name within the `nameof()` operator.

The fix in action:

Expand All @@ -63,7 +66,8 @@ public static object[] MyTestSource()

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1003.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public void NUnit1003SampleTest(string parameter1, string parameter2)

### Explanation

In the sample above, the test expects two parameters (`(string parameter1, string parameter2)`), but only one argument is supplied by the test case (`TestCase("1")`).
In the sample above, the test expects two parameters (`(string parameter1, string parameter2)`), but only one argument
is supplied by the test case (`TestCase("1")`).

### Fix

Expand Down Expand Up @@ -63,7 +64,8 @@ public void NUnit1003SampleTest(string parameter1)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1004.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void NUnit1004SampleTest(string parameter1)

### Explanation

In the sample above, there are two arguments provided by test case (`TestCase("1", "2")`), but only one parameter is being expected by the test itself (`(string parameter1)`).
In the sample above, there are two arguments provided by test case (`TestCase("1", "2")`), but only one parameter is
being expected by the test itself (`(string parameter1)`).

### Fix

Expand Down Expand Up @@ -62,7 +63,8 @@ public void NUnit1003SampleTest(string parameter1)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
9 changes: 6 additions & 3 deletions documentation/NUnit1005.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

## Description

The type of the value specified via ExpectedResult must match the return type of the method. Otherwise, this will lead to an error at run-time.
The type of the value specified via ExpectedResult must match the return type of the method. Otherwise, this will lead
to an error at run-time.

## Motivation

Expand All @@ -32,7 +33,8 @@ public int NUnit1005SampleTest(int inputValue)

### Explanation

The sample above uses NUnit's `ExpectedResult` syntax. It defines a result of `true` (a `bool`) but the return type of the method is `int`.
The sample above uses NUnit's `ExpectedResult` syntax. It defines a result of `true` (a `bool`) but the return type of
the method is `int`.

### Fix

Expand Down Expand Up @@ -61,7 +63,8 @@ public bool NUnit1005SampleTest(int inputValue)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1006.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void NUnit1006SampleTest(int inputValue)

### Explanation

An `ExpectedResult` was defined, but the return type of the method in our sample is of type `void`, meaning it does not return a result.
An `ExpectedResult` was defined, but the return type of the method in our sample is of type `void`, meaning it does not
return a result.

### Fix

Expand Down Expand Up @@ -61,7 +62,8 @@ public string NUnit1006SampleTest(int inputValue)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1007.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public string NUnit1007SampleTest(int inputValue)

### Explanation

No `ExpectedResult` was defined, but the return type of the method in our sample is of type `string`, meaning it does indeed return a result and we should use the `ExpectedResult` syntax in order to capture it.
No `ExpectedResult` was defined, but the return type of the method in our sample is of type `string`, meaning it does
indeed return a result and we should use the `ExpectedResult` syntax in order to capture it.

### Fix

Expand Down Expand Up @@ -61,7 +62,8 @@ public void NUnit1007SampleTest(int inputValue)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
9 changes: 6 additions & 3 deletions documentation/NUnit1008.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Specifying ParallelScope.Self on assembly level has no effect.

## Motivation

Bring developers' attention to a scenario in which they may believe they are parallelizing something when in fact they are not and their efforts will have no effect.
Bring developers' attention to a scenario in which they may believe they are parallelizing something when in fact they
are not and their efforts will have no effect.

## How to fix violations

Expand All @@ -30,7 +31,8 @@ In `AssemblyInfo.cs`:

### Explanation

`ParallelScope.Self` [only applies to classes and methods](https://github.com/nunit/docs/wiki/Parallelizable-Attribute), not to assemblies.
`ParallelScope.Self` [only applies to classes and methods](https://github.com/nunit/docs/wiki/Parallelizable-Attribute),
not to assemblies.

### Fix

Expand All @@ -51,7 +53,8 @@ Or:

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1009.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void NUnit1009SampleTest()

In the sample above, the `Parallelizable` attribute is used with `ParallelScope.Children`.

However, in a non-parameterized test, such as a `[Test]` and not a `[TestCase]`, there will be no children generated, and thus this type of parallelization does not make sense.
However, in a non-parameterized test, such as a `[Test]` and not a `[TestCase]`, there will be no children generated,
and thus this type of parallelization does not make sense.

### Fix

Expand Down Expand Up @@ -66,7 +67,8 @@ public void NUnit1009SampleTest(int numberValue)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1010.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void NUnit1010SampleTest()

In the sample above, `ParallelScope.Fixtures` is specified.

However, in the context of a test method, a scope of `Fixtures` does not make sense. This scope [only applies at the assembly or class level](https://github.com/nunit/docs/wiki/Parallelizable-Attribute).
However, in the context of a test method, a scope of `Fixtures` does not make sense. This scope [only applies at the
assembly or class level](https://github.com/nunit/docs/wiki/Parallelizable-Attribute).

### Fix

Expand Down Expand Up @@ -79,7 +80,8 @@ public void NUnit1010SampleTest()

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1011.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static object[] MyTestSource()

### Explanation

In the example above, the test case source is named `MyIncorrectTestCaseSource`, but the test case source is actually named `MyTestSource`. Because the names don't match, this will be an error.
In the example above, the test case source is named `MyIncorrectTestCaseSource`, but the test case source is actually
named `MyTestSource`. Because the names don't match, this will be an error.

### Fix

Expand Down Expand Up @@ -76,7 +77,8 @@ public static object[] MyTestSource()

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
7 changes: 5 additions & 2 deletions documentation/NUnit1012.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public async void NUnit1012SampleTest()

### Explanation

`async` methods should generally not return `void` in C#. For example if an exception is thrown (as they are in the case of an assertion violation), the exception is actually a part of the task object. If the return type is `void`, no such object exists, to the exception is effectively swallowed.
`async` methods should generally not return `void` in C#. For example if an exception is thrown (as they are in the case
of an assertion violation), the exception is actually a part of the task object. If the return type is `void`, no such
object exists, to the exception is effectively swallowed.

### Fix

Expand Down Expand Up @@ -64,7 +66,8 @@ public void NUnit1012SampleTest()

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1013.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public Task<string> ConvertNumber(int numberValue)

### Explanation

The NUnit `ExpectedResult` syntax is not used, so it's an error for this method to return something that isn't being checked.
The NUnit `ExpectedResult` syntax is not used, so it's an error for this method to return something that isn't being
checked.

### Fix

Expand Down Expand Up @@ -78,7 +79,8 @@ public Task<string> ConvertNumber(int numberValue)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1014.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public async Task NUnit1014SampleTest(int numberValue)

### Explanation

The NUnit `ExpectedResult` syntax is used, so this method needs to return a type that matches the type of expected result you're looking for.
The NUnit `ExpectedResult` syntax is used, so this method needs to return a type that matches the type of expected
result you're looking for.

### Fix

Expand Down Expand Up @@ -61,7 +62,8 @@ public async Task<bool> NUnit1014SampleTest(int numberValue)

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1015.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class DivideCases

In the sample above, the class `DivideCases` does not implement `IEnumerable` nor `IAsyncEnumerable`

However, source types specified by `TestCaseSource` [must implement `IEnumerable` or `IAsyncEnumerable`](https://github.com/nunit/docs/wiki/TestCaseSource-Attribute).
However, source types specified by `TestCaseSource`
[must implement `IEnumerable` or `IAsyncEnumerable`](https://github.com/nunit/docs/wiki/TestCaseSource-Attribute).

### Fix

Expand Down Expand Up @@ -79,7 +80,8 @@ class DivideCases : IEnumerable

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1016.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class DivideCases : IEnumerable

In the sample above, the class `DivideCases` does not have a default constructor - i.e. a constructor with no parameters.

However, source types specified by `TestCaseSource` [must have a default constructor](https://github.com/nunit/docs/wiki/TestCaseSource-Attribute).
However, source types specified by `TestCaseSource`
[must have a default constructor](https://github.com/nunit/docs/wiki/TestCaseSource-Attribute).

### Fix

Expand Down Expand Up @@ -85,7 +86,8 @@ class DivideCases : IEnumerable

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
6 changes: 4 additions & 2 deletions documentation/NUnit1017.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public class MyTestClass

In the sample above, `DivideCases` is not a `static` field.

However, sources specified by `TestCaseSource` [must be `static`](https://github.com/nunit/docs/wiki/TestCaseSource-Attribute).
However, sources specified by `TestCaseSource`
[must be `static`](https://github.com/nunit/docs/wiki/TestCaseSource-Attribute).

### Fix

Expand Down Expand Up @@ -73,7 +74,8 @@ public class MyTestClass

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
3 changes: 2 additions & 1 deletion documentation/NUnit1018.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public class MyTestClass

### Via ruleset file

Configure the severity per project, for more info see [MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).
Configure the severity per project, for more info see
[MSDN](https://learn.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2022).

### Via .editorconfig file

Expand Down
Loading

0 comments on commit e185aaa

Please sign in to comment.