From 11034a5edfad411afa152a0eb2a2f76c908bd883 Mon Sep 17 00:00:00 2001 From: Mikkel Bundgaard Date: Fri, 15 Nov 2024 14:03:59 +0000 Subject: [PATCH] chore: Bump NUnit.Analyzers documentation to version 4.4.0 --- .../nunit-analyzers/NUnit-Analyzers.md | 13 +++ docs/articles/nunit-analyzers/NUnit1001.md | 8 +- docs/articles/nunit-analyzers/NUnit1002.md | 2 +- docs/articles/nunit-analyzers/NUnit1003.md | 2 +- docs/articles/nunit-analyzers/NUnit1004.md | 2 +- docs/articles/nunit-analyzers/NUnit1005.md | 2 +- docs/articles/nunit-analyzers/NUnit1006.md | 2 +- docs/articles/nunit-analyzers/NUnit1007.md | 2 +- docs/articles/nunit-analyzers/NUnit1008.md | 2 +- docs/articles/nunit-analyzers/NUnit1009.md | 2 +- docs/articles/nunit-analyzers/NUnit1010.md | 2 +- docs/articles/nunit-analyzers/NUnit1011.md | 2 +- docs/articles/nunit-analyzers/NUnit1012.md | 2 +- docs/articles/nunit-analyzers/NUnit1013.md | 2 +- docs/articles/nunit-analyzers/NUnit1014.md | 2 +- docs/articles/nunit-analyzers/NUnit1015.md | 2 +- docs/articles/nunit-analyzers/NUnit1016.md | 2 +- docs/articles/nunit-analyzers/NUnit1017.md | 2 +- docs/articles/nunit-analyzers/NUnit1018.md | 2 +- docs/articles/nunit-analyzers/NUnit1019.md | 2 +- docs/articles/nunit-analyzers/NUnit1020.md | 2 +- docs/articles/nunit-analyzers/NUnit1021.md | 2 +- docs/articles/nunit-analyzers/NUnit1022.md | 2 +- docs/articles/nunit-analyzers/NUnit1023.md | 2 +- docs/articles/nunit-analyzers/NUnit1024.md | 2 +- docs/articles/nunit-analyzers/NUnit1025.md | 2 +- docs/articles/nunit-analyzers/NUnit1026.md | 2 +- docs/articles/nunit-analyzers/NUnit1027.md | 2 +- docs/articles/nunit-analyzers/NUnit1028.md | 2 +- docs/articles/nunit-analyzers/NUnit1029.md | 2 +- docs/articles/nunit-analyzers/NUnit1030.md | 2 +- docs/articles/nunit-analyzers/NUnit1031.md | 2 +- docs/articles/nunit-analyzers/NUnit1032.md | 38 ++++++++- docs/articles/nunit-analyzers/NUnit1033.md | 79 ++++++++++++++++++ docs/articles/nunit-analyzers/NUnit2001.md | 2 +- docs/articles/nunit-analyzers/NUnit2002.md | 2 +- docs/articles/nunit-analyzers/NUnit2003.md | 2 +- docs/articles/nunit-analyzers/NUnit2004.md | 2 +- docs/articles/nunit-analyzers/NUnit2005.md | 2 +- docs/articles/nunit-analyzers/NUnit2006.md | 2 +- docs/articles/nunit-analyzers/NUnit2007.md | 2 +- docs/articles/nunit-analyzers/NUnit2008.md | 2 +- docs/articles/nunit-analyzers/NUnit2009.md | 2 +- docs/articles/nunit-analyzers/NUnit2010.md | 2 +- docs/articles/nunit-analyzers/NUnit2011.md | 2 +- docs/articles/nunit-analyzers/NUnit2012.md | 2 +- docs/articles/nunit-analyzers/NUnit2013.md | 2 +- docs/articles/nunit-analyzers/NUnit2014.md | 2 +- docs/articles/nunit-analyzers/NUnit2015.md | 2 +- docs/articles/nunit-analyzers/NUnit2016.md | 2 +- docs/articles/nunit-analyzers/NUnit2017.md | 2 +- docs/articles/nunit-analyzers/NUnit2018.md | 2 +- docs/articles/nunit-analyzers/NUnit2019.md | 2 +- docs/articles/nunit-analyzers/NUnit2020.md | 2 +- docs/articles/nunit-analyzers/NUnit2021.md | 2 +- docs/articles/nunit-analyzers/NUnit2022.md | 2 +- docs/articles/nunit-analyzers/NUnit2023.md | 2 +- docs/articles/nunit-analyzers/NUnit2024.md | 2 +- docs/articles/nunit-analyzers/NUnit2025.md | 2 +- docs/articles/nunit-analyzers/NUnit2026.md | 2 +- docs/articles/nunit-analyzers/NUnit2027.md | 2 +- docs/articles/nunit-analyzers/NUnit2028.md | 2 +- docs/articles/nunit-analyzers/NUnit2029.md | 2 +- docs/articles/nunit-analyzers/NUnit2030.md | 2 +- docs/articles/nunit-analyzers/NUnit2031.md | 2 +- docs/articles/nunit-analyzers/NUnit2032.md | 2 +- docs/articles/nunit-analyzers/NUnit2033.md | 2 +- docs/articles/nunit-analyzers/NUnit2034.md | 2 +- docs/articles/nunit-analyzers/NUnit2035.md | 2 +- docs/articles/nunit-analyzers/NUnit2036.md | 2 +- docs/articles/nunit-analyzers/NUnit2037.md | 2 +- docs/articles/nunit-analyzers/NUnit2038.md | 2 +- docs/articles/nunit-analyzers/NUnit2039.md | 2 +- docs/articles/nunit-analyzers/NUnit2040.md | 2 +- docs/articles/nunit-analyzers/NUnit2041.md | 2 +- docs/articles/nunit-analyzers/NUnit2042.md | 2 +- docs/articles/nunit-analyzers/NUnit2043.md | 2 +- docs/articles/nunit-analyzers/NUnit2044.md | 2 +- docs/articles/nunit-analyzers/NUnit2045.md | 2 +- docs/articles/nunit-analyzers/NUnit2046.md | 2 +- docs/articles/nunit-analyzers/NUnit2047.md | 2 +- docs/articles/nunit-analyzers/NUnit2048.md | 2 +- docs/articles/nunit-analyzers/NUnit2049.md | 2 +- docs/articles/nunit-analyzers/NUnit2050.md | 25 ++++-- docs/articles/nunit-analyzers/NUnit2051.md | 82 ++++++++++++++++++ docs/articles/nunit-analyzers/NUnit2052.md | 82 ++++++++++++++++++ docs/articles/nunit-analyzers/NUnit2053.md | 82 ++++++++++++++++++ docs/articles/nunit-analyzers/NUnit2054.md | 83 +++++++++++++++++++ docs/articles/nunit-analyzers/NUnit3001.md | 4 +- docs/articles/nunit-analyzers/NUnit3002.md | 4 +- docs/articles/nunit-analyzers/NUnit3003.md | 4 +- docs/articles/nunit-analyzers/NUnit3004.md | 4 +- docs/articles/nunit-analyzers/NUnit4001.md | 78 +++++++++++++++++ docs/articles/nunit-analyzers/toc.yml | 14 +++- 94 files changed, 662 insertions(+), 96 deletions(-) create mode 100644 docs/articles/nunit-analyzers/NUnit1033.md create mode 100644 docs/articles/nunit-analyzers/NUnit2051.md create mode 100644 docs/articles/nunit-analyzers/NUnit2052.md create mode 100644 docs/articles/nunit-analyzers/NUnit2053.md create mode 100644 docs/articles/nunit-analyzers/NUnit2054.md create mode 100644 docs/articles/nunit-analyzers/NUnit4001.md diff --git a/docs/articles/nunit-analyzers/NUnit-Analyzers.md b/docs/articles/nunit-analyzers/NUnit-Analyzers.md index 6f141e1d8..19a485fdf 100644 --- a/docs/articles/nunit-analyzers/NUnit-Analyzers.md +++ b/docs/articles/nunit-analyzers/NUnit-Analyzers.md @@ -55,6 +55,7 @@ Rules which enforce structural requirements on the test code. | [NUnit1030](NUnit1030.md) | The type of parameter provided by the TestCaseSource does not match the type of the parameter in the Test method | :white_check_mark: | :exclamation: | :x: | | [NUnit1031](NUnit1031.md) | The individual arguments provided by a ValuesAttribute must match the type of the corresponding parameter of the method | :white_check_mark: | :exclamation: | :x: | | [NUnit1032](NUnit1032.md) | An IDisposable field/property should be Disposed in a TearDown method | :white_check_mark: | :exclamation: | :x: | +| [NUnit1033](NUnit1033.md) | The Write methods on TestContext will be marked as Obsolete and eventually removed | :white_check_mark: | :warning: | :white_check_mark: | ## Assertion Rules (NUnit2001 - ) @@ -112,6 +113,10 @@ Rules which improve assertions in the test code. | [NUnit2048](NUnit2048.md) | Consider using Assert.That(...) instead of StringAssert(...) | :white_check_mark: | :warning: | :white_check_mark: | | [NUnit2049](NUnit2049.md) | Consider using Assert.That(...) instead of CollectionAssert(...) | :white_check_mark: | :warning: | :white_check_mark: | | [NUnit2050](NUnit2050.md) | NUnit 4 no longer supports string.Format specification | :white_check_mark: | :exclamation: | :white_check_mark: | +| [NUnit2051](NUnit2051.md) | Consider using Assert.That(expr, Is.Positive) instead of ClassicAssert.Positive(expr) | :white_check_mark: | :information_source: | :white_check_mark: | +| [NUnit2052](NUnit2052.md) | Consider using Assert.That(expr, Is.Negative) instead of ClassicAssert.Negative(expr) | :white_check_mark: | :information_source: | :white_check_mark: | +| [NUnit2053](NUnit2053.md) | Consider using Assert.That(actual, Is.AssignableFrom(expected)) instead of ClassicAssert.IsAssignableFrom(expected, actual) | :white_check_mark: | :information_source: | :white_check_mark: | +| [NUnit2054](NUnit2054.md) | Consider using Assert.That(actual, Is.Not.AssignableFrom(expected)) instead of ClassicAssert.IsNotAssignableFrom(expected, actual) | :white_check_mark: | :information_source: | :white_check_mark: | ## Suppressor Rules (NUnit3001 - ) @@ -124,3 +129,11 @@ builds (version 3.0.0 and above) which require Visual Studio 2019 (version 16.3) | [NUnit3002](NUnit3002.md) | Field/Property is initialized in SetUp or OneTimeSetUp method | :white_check_mark: | :information_source: | :x: | | [NUnit3003](NUnit3003.md) | Class is an NUnit TestFixture and is instantiated using reflection | :white_check_mark: | :information_source: | :x: | | [NUnit3004](NUnit3004.md) | Field should be Disposed in TearDown or OneTimeTearDown method | :white_check_mark: | :information_source: | :x: | + +## Style Rules (NUnit4001 - ) + +Rules which help you write concise and readable NUnit test code. + +| Id | Title | :mag: | :memo: | :bulb: | +| :-- | :-- | :--: | :--: | :--: | +| [NUnit4001](NUnit4001.md) | Simplify the Values attribute | :white_check_mark: | :information_source: | :x: | diff --git a/docs/articles/nunit-analyzers/NUnit1001.md b/docs/articles/nunit-analyzers/NUnit1001.md index 32d0d98fa..e39757a8c 100644 --- a/docs/articles/nunit-analyzers/NUnit1001.md +++ b/docs/articles/nunit-analyzers/NUnit1001.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseUsage/TestCaseUsageAnalyzer.cs) +| Code | [TestCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseUsage/TestCaseUsageAnalyzer.cs) ## Description @@ -29,6 +29,12 @@ public void SampleTest(int numberValue) { Assert.That(numberValue, Is.EqualTo(1)); } + +[TestCase(42)] +public void SampleTest(int numberValue) +{ + Assert.That(numberValue, Is.EqualTo(1)); +} ``` ### Problem diff --git a/docs/articles/nunit-analyzers/NUnit1002.md b/docs/articles/nunit-analyzers/NUnit1002.md index c4383ec0f..0fcd06086 100644 --- a/docs/articles/nunit-analyzers/NUnit1002.md +++ b/docs/articles/nunit-analyzers/NUnit1002.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1003.md b/docs/articles/nunit-analyzers/NUnit1003.md index 894741351..44b48de14 100644 --- a/docs/articles/nunit-analyzers/NUnit1003.md +++ b/docs/articles/nunit-analyzers/NUnit1003.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseUsage/TestCaseUsageAnalyzer.cs) +| Code | [TestCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseUsage/TestCaseUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1004.md b/docs/articles/nunit-analyzers/NUnit1004.md index 75ce3e43d..ea7d4643b 100644 --- a/docs/articles/nunit-analyzers/NUnit1004.md +++ b/docs/articles/nunit-analyzers/NUnit1004.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseUsage/TestCaseUsageAnalyzer.cs) +| Code | [TestCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseUsage/TestCaseUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1005.md b/docs/articles/nunit-analyzers/NUnit1005.md index 463d1c36d..ceb2869ff 100644 --- a/docs/articles/nunit-analyzers/NUnit1005.md +++ b/docs/articles/nunit-analyzers/NUnit1005.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) +| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1006.md b/docs/articles/nunit-analyzers/NUnit1006.md index 44a9c9c9d..24c4f487a 100644 --- a/docs/articles/nunit-analyzers/NUnit1006.md +++ b/docs/articles/nunit-analyzers/NUnit1006.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) +| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1007.md b/docs/articles/nunit-analyzers/NUnit1007.md index 8b4b51c46..d9b07dd75 100644 --- a/docs/articles/nunit-analyzers/NUnit1007.md +++ b/docs/articles/nunit-analyzers/NUnit1007.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) +| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1008.md b/docs/articles/nunit-analyzers/NUnit1008.md index 616466910..cd10bf233 100644 --- a/docs/articles/nunit-analyzers/NUnit1008.md +++ b/docs/articles/nunit-analyzers/NUnit1008.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Structure -| Code | [ParallelizableUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ParallelizableUsage/ParallelizableUsageAnalyzer.cs) +| Code | [ParallelizableUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ParallelizableUsage/ParallelizableUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1009.md b/docs/articles/nunit-analyzers/NUnit1009.md index 1381888ad..1274eb156 100644 --- a/docs/articles/nunit-analyzers/NUnit1009.md +++ b/docs/articles/nunit-analyzers/NUnit1009.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [ParallelizableUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ParallelizableUsage/ParallelizableUsageAnalyzer.cs) +| Code | [ParallelizableUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ParallelizableUsage/ParallelizableUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1010.md b/docs/articles/nunit-analyzers/NUnit1010.md index 8c8a056f4..8a392ec59 100644 --- a/docs/articles/nunit-analyzers/NUnit1010.md +++ b/docs/articles/nunit-analyzers/NUnit1010.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [ParallelizableUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ParallelizableUsage/ParallelizableUsageAnalyzer.cs) +| Code | [ParallelizableUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ParallelizableUsage/ParallelizableUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1011.md b/docs/articles/nunit-analyzers/NUnit1011.md index 8e62758d5..7768d507b 100644 --- a/docs/articles/nunit-analyzers/NUnit1011.md +++ b/docs/articles/nunit-analyzers/NUnit1011.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1012.md b/docs/articles/nunit-analyzers/NUnit1012.md index e28c53edb..ecb564c43 100644 --- a/docs/articles/nunit-analyzers/NUnit1012.md +++ b/docs/articles/nunit-analyzers/NUnit1012.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) +| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1013.md b/docs/articles/nunit-analyzers/NUnit1013.md index 07b359c93..f8f735b52 100644 --- a/docs/articles/nunit-analyzers/NUnit1013.md +++ b/docs/articles/nunit-analyzers/NUnit1013.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) +| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1014.md b/docs/articles/nunit-analyzers/NUnit1014.md index a0abbc91a..6fb1f9c5d 100644 --- a/docs/articles/nunit-analyzers/NUnit1014.md +++ b/docs/articles/nunit-analyzers/NUnit1014.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) +| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1015.md b/docs/articles/nunit-analyzers/NUnit1015.md index a3af03788..83b0688a1 100644 --- a/docs/articles/nunit-analyzers/NUnit1015.md +++ b/docs/articles/nunit-analyzers/NUnit1015.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1016.md b/docs/articles/nunit-analyzers/NUnit1016.md index 7f1c65270..16d2e2fd1 100644 --- a/docs/articles/nunit-analyzers/NUnit1016.md +++ b/docs/articles/nunit-analyzers/NUnit1016.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1017.md b/docs/articles/nunit-analyzers/NUnit1017.md index 2ec1c81c0..f7ce10f38 100644 --- a/docs/articles/nunit-analyzers/NUnit1017.md +++ b/docs/articles/nunit-analyzers/NUnit1017.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1018.md b/docs/articles/nunit-analyzers/NUnit1018.md index 0ffea4a52..666511766 100644 --- a/docs/articles/nunit-analyzers/NUnit1018.md +++ b/docs/articles/nunit-analyzers/NUnit1018.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1019.md b/docs/articles/nunit-analyzers/NUnit1019.md index 931daea6a..092fd81ba 100644 --- a/docs/articles/nunit-analyzers/NUnit1019.md +++ b/docs/articles/nunit-analyzers/NUnit1019.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1020.md b/docs/articles/nunit-analyzers/NUnit1020.md index 94a08d16a..03701dfc2 100644 --- a/docs/articles/nunit-analyzers/NUnit1020.md +++ b/docs/articles/nunit-analyzers/NUnit1020.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1021.md b/docs/articles/nunit-analyzers/NUnit1021.md index cfc7cb0de..c77ea0b48 100644 --- a/docs/articles/nunit-analyzers/NUnit1021.md +++ b/docs/articles/nunit-analyzers/NUnit1021.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Structure -| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) +| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1022.md b/docs/articles/nunit-analyzers/NUnit1022.md index c16a96be1..352ba1241 100644 --- a/docs/articles/nunit-analyzers/NUnit1022.md +++ b/docs/articles/nunit-analyzers/NUnit1022.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) +| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1023.md b/docs/articles/nunit-analyzers/NUnit1023.md index 38bc9bd4e..2f75571e2 100644 --- a/docs/articles/nunit-analyzers/NUnit1023.md +++ b/docs/articles/nunit-analyzers/NUnit1023.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) +| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1024.md b/docs/articles/nunit-analyzers/NUnit1024.md index 8772d89f6..33dbf8b91 100644 --- a/docs/articles/nunit-analyzers/NUnit1024.md +++ b/docs/articles/nunit-analyzers/NUnit1024.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) +| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1025.md b/docs/articles/nunit-analyzers/NUnit1025.md index 734052b2b..0e6b6b220 100644 --- a/docs/articles/nunit-analyzers/NUnit1025.md +++ b/docs/articles/nunit-analyzers/NUnit1025.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) +| Code | [ValueSourceUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ValueSourceUsage/ValueSourceUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1026.md b/docs/articles/nunit-analyzers/NUnit1026.md index 4ddb4e0e0..43990aa3b 100644 --- a/docs/articles/nunit-analyzers/NUnit1026.md +++ b/docs/articles/nunit-analyzers/NUnit1026.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodAccessibilityLevelAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodAccessibilityLevel/TestMethodAccessibilityLevelAnalyzer.cs) +| Code | [TestMethodAccessibilityLevelAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodAccessibilityLevel/TestMethodAccessibilityLevelAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1027.md b/docs/articles/nunit-analyzers/NUnit1027.md index 1dac7b030..1c4529a56 100644 --- a/docs/articles/nunit-analyzers/NUnit1027.md +++ b/docs/articles/nunit-analyzers/NUnit1027.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) +| Code | [TestMethodUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestMethodUsage/TestMethodUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1028.md b/docs/articles/nunit-analyzers/NUnit1028.md index 2beea59e7..865b248ed 100644 --- a/docs/articles/nunit-analyzers/NUnit1028.md +++ b/docs/articles/nunit-analyzers/NUnit1028.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Structure -| Code | [NonTestMethodAccessibilityLevelAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/NonTestMethodAccessibilityLevel/NonTestMethodAccessibilityLevelAnalyzer.cs) +| Code | [NonTestMethodAccessibilityLevelAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/NonTestMethodAccessibilityLevel/NonTestMethodAccessibilityLevelAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1029.md b/docs/articles/nunit-analyzers/NUnit1029.md index 3c63b8980..97cc91b43 100644 --- a/docs/articles/nunit-analyzers/NUnit1029.md +++ b/docs/articles/nunit-analyzers/NUnit1029.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1030.md b/docs/articles/nunit-analyzers/NUnit1030.md index 500f07a3c..efa08ec7a 100644 --- a/docs/articles/nunit-analyzers/NUnit1030.md +++ b/docs/articles/nunit-analyzers/NUnit1030.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) +| Code | [TestCaseSourceUsesStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestCaseSourceUsage/TestCaseSourceUsesStringAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1031.md b/docs/articles/nunit-analyzers/NUnit1031.md index 8321e3aea..8566a9492 100644 --- a/docs/articles/nunit-analyzers/NUnit1031.md +++ b/docs/articles/nunit-analyzers/NUnit1031.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [ValuesUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ValuesUsage/ValuesUsageAnalyzer.cs) +| Code | [ValuesUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ValuesUsage/ValuesUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit1032.md b/docs/articles/nunit-analyzers/NUnit1032.md index f84b9e91d..bdba05e88 100644 --- a/docs/articles/nunit-analyzers/NUnit1032.md +++ b/docs/articles/nunit-analyzers/NUnit1032.md @@ -8,22 +8,58 @@ | Severity | Error | Enabled | True | Category | Structure -| Code | [DisposeFieldsAndPropertiesInTearDownAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DisposeFieldsAndPropertiesInTearDown/DisposeFieldsAndPropertiesInTearDownAnalyzer.cs) +| Code | [DisposeFieldsAndPropertiesInTearDownAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DisposeFieldsAndPropertiesInTearDown/DisposeFieldsAndPropertiesInTearDownAnalyzer.cs) ## Description An IDisposable field/property should be Disposed in a TearDown method. +This analyzer rule only applies to a `TestFixture` which is using the default +NUnit `SingleInstance` life cycle where the class is instantiated once for all tests. + +If you are using `LifeCycle.InstancePerTestCase` you should dispose the fields/properties +in the `Dispose` method of the test class. + ## Motivation Not Disposing fields/properties can cause memory leaks or failing tests. ## How to fix violations +### LifeCycle.SingleInstance + Dispose any fields/properties that are initialized in `SetUp` or `Test` methods in a `TearDown` method. Fields/Properties that are initialized in `OneTimeSetUp`, or with initializers or in constructors must be disposed in `OneTimeTearDown`. +### LifeCycle.InstancePerTestCase + +If you have `IDisposable` fields or properties, your class must implement the +[`IDisposable`](https://learn.microsoft.com/en-us/dotnet/api/system.idisposable?view=net-8.0) interface. + +Dispose any fields/properties that are initialized at declaration or in the constructor in the +[`Dispose`](https://learn.microsoft.com/en-us/dotnet/api/system.idisposable.dispose?view=net-8.0) method. + +The NUnit.Analyzer will not help you here as the functionality is available in +[Microsoft .NET Analyzers](https://www.nuget.org/packages/Microsoft.CodeAnalysis.NetAnalyzers). +These are the rules that will help you with this: + +* [CA1001](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1001) +Types that own disposable fields should be disposable +* [CA2213](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2213) +Disposable fields should be disposed + +Unfortunately, those rules are not enabled by default, you can enable them in your project in a +[`.editorconfig`](https://learn.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022#manually-configure-rule-severity-in-an-editorconfig-file) + file using the following content: + +```xml +# CA1001: Types that own disposable fields should be disposable +dotnet_diagnostic.CA1001.severity = warning +# CA2213: Disposable fields should be disposed +dotnet_diagnostic.CA2213.severity = warning +``` + ## Configure severity diff --git a/docs/articles/nunit-analyzers/NUnit1033.md b/docs/articles/nunit-analyzers/NUnit1033.md new file mode 100644 index 000000000..681581a3a --- /dev/null +++ b/docs/articles/nunit-analyzers/NUnit1033.md @@ -0,0 +1,79 @@ +# NUnit1033 + +## The Write methods on TestContext will be marked as Obsolete and eventually removed + +| Topic | Value +| :-- | :-- +| Id | NUnit1033 +| Severity | Warning +| Enabled | True +| Category | Structure +| Code | [TestContextWriteIsObsoleteAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/TestContextWriteIsObsolete/TestContextWriteIsObsoleteAnalyzer.cs) + +## Description + +Direct `Write` calls should be replaced with `Out.Write`. + +Future version of NUnit will first mark the `.Write` methods on `TestContext` +as `Obsolete` and eventually remove them. + +This rule allows updating your code before the methods are removed. + +## Motivation + +The `Write` methods are simple wrappers calling `Out.Write`. +There is no wrapper for `Error` which always required to use `TestContext.Error.Write`. +Besides this being inconsistent, later versions of .NET added new overloads, + e.g. for `ReadOnlySpan` and `async` methods like `WriteAsync`. +Instead of adding more and more dummy wrappers, it was decided that user code should use + the `Out` property and then can use any `Write` overload available on `TextWriter`. + +## How to fix violations + +Simply insert `.Out` between `TestContext` and `.Write`. + +`TestContext.WriteLine("This isn't right");` + +becomes + +`TestContext.Out.WriteLine("This isn't right");` + + +## Configure severity + +### 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). + +### Via .editorconfig file + +```ini +# NUnit1033: The Write methods on TestContext will be marked as Obsolete and eventually removed +dotnet_diagnostic.NUnit1033.severity = chosenSeverity +``` + +where `chosenSeverity` can be one of `none`, `silent`, `suggestion`, `warning`, or `error`. + +### Via #pragma directive + +```csharp +#pragma warning disable NUnit1033 // The Write methods on TestContext will be marked as Obsolete and eventually removed +Code violating the rule here +#pragma warning restore NUnit1033 // The Write methods on TestContext will be marked as Obsolete and eventually removed +``` + +Or put this at the top of the file to disable all instances. + +```csharp +#pragma warning disable NUnit1033 // The Write methods on TestContext will be marked as Obsolete and eventually removed +``` + +### Via attribute `[SuppressMessage]` + +```csharp +[System.Diagnostics.CodeAnalysis.SuppressMessage("Structure", + "NUnit1033:The Write methods on TestContext will be marked as Obsolete and eventually removed", + Justification = "Reason...")] +``` + diff --git a/docs/articles/nunit-analyzers/NUnit2001.md b/docs/articles/nunit-analyzers/NUnit2001.md index c60ec3d9b..10e1fa1b1 100644 --- a/docs/articles/nunit-analyzers/NUnit2001.md +++ b/docs/articles/nunit-analyzers/NUnit2001.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2002.md b/docs/articles/nunit-analyzers/NUnit2002.md index 8ff0d0dd8..6273d5081 100644 --- a/docs/articles/nunit-analyzers/NUnit2002.md +++ b/docs/articles/nunit-analyzers/NUnit2002.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2003.md b/docs/articles/nunit-analyzers/NUnit2003.md index 9d1715d74..a005afd85 100644 --- a/docs/articles/nunit-analyzers/NUnit2003.md +++ b/docs/articles/nunit-analyzers/NUnit2003.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2004.md b/docs/articles/nunit-analyzers/NUnit2004.md index febbadff0..3f7dbacd5 100644 --- a/docs/articles/nunit-analyzers/NUnit2004.md +++ b/docs/articles/nunit-analyzers/NUnit2004.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2005.md b/docs/articles/nunit-analyzers/NUnit2005.md index 1d7ef1fa4..35137f7db 100644 --- a/docs/articles/nunit-analyzers/NUnit2005.md +++ b/docs/articles/nunit-analyzers/NUnit2005.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2006.md b/docs/articles/nunit-analyzers/NUnit2006.md index be5b47a8f..8eca6688d 100644 --- a/docs/articles/nunit-analyzers/NUnit2006.md +++ b/docs/articles/nunit-analyzers/NUnit2006.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2007.md b/docs/articles/nunit-analyzers/NUnit2007.md index 5a3c1fe2b..2d13cdcdf 100644 --- a/docs/articles/nunit-analyzers/NUnit2007.md +++ b/docs/articles/nunit-analyzers/NUnit2007.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [ConstActualValueUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ConstActualValueUsage/ConstActualValueUsageAnalyzer.cs) +| Code | [ConstActualValueUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ConstActualValueUsage/ConstActualValueUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2008.md b/docs/articles/nunit-analyzers/NUnit2008.md index c5b1c50b0..ce3c0d797 100644 --- a/docs/articles/nunit-analyzers/NUnit2008.md +++ b/docs/articles/nunit-analyzers/NUnit2008.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [IgnoreCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/IgnoreCaseUsage/IgnoreCaseUsageAnalyzer.cs) +| Code | [IgnoreCaseUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/IgnoreCaseUsage/IgnoreCaseUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2009.md b/docs/articles/nunit-analyzers/NUnit2009.md index fd1bbff54..b0ac5cf8c 100644 --- a/docs/articles/nunit-analyzers/NUnit2009.md +++ b/docs/articles/nunit-analyzers/NUnit2009.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [SameActualExpectedValueAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/SameActualExpectedValue/SameActualExpectedValueAnalyzer.cs) +| Code | [SameActualExpectedValueAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/SameActualExpectedValue/SameActualExpectedValueAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2010.md b/docs/articles/nunit-analyzers/NUnit2010.md index 0fb4f5f0c..a677ffd30 100644 --- a/docs/articles/nunit-analyzers/NUnit2010.md +++ b/docs/articles/nunit-analyzers/NUnit2010.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [EqualConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ConstraintUsage/EqualConstraintUsageAnalyzer.cs) +| Code | [EqualConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ConstraintUsage/EqualConstraintUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2011.md b/docs/articles/nunit-analyzers/NUnit2011.md index 4fc67a011..05b9f0daa 100644 --- a/docs/articles/nunit-analyzers/NUnit2011.md +++ b/docs/articles/nunit-analyzers/NUnit2011.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [StringConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ConstraintUsage/StringConstraintUsageAnalyzer.cs) +| Code | [StringConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ConstraintUsage/StringConstraintUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2012.md b/docs/articles/nunit-analyzers/NUnit2012.md index 262af9dbb..1b2831bf7 100644 --- a/docs/articles/nunit-analyzers/NUnit2012.md +++ b/docs/articles/nunit-analyzers/NUnit2012.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [StringConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ConstraintUsage/StringConstraintUsageAnalyzer.cs) +| Code | [StringConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ConstraintUsage/StringConstraintUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2013.md b/docs/articles/nunit-analyzers/NUnit2013.md index 3de7c9694..52a02395b 100644 --- a/docs/articles/nunit-analyzers/NUnit2013.md +++ b/docs/articles/nunit-analyzers/NUnit2013.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [StringConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ConstraintUsage/StringConstraintUsageAnalyzer.cs) +| Code | [StringConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ConstraintUsage/StringConstraintUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2014.md b/docs/articles/nunit-analyzers/NUnit2014.md index d818071ed..7071a1010 100644 --- a/docs/articles/nunit-analyzers/NUnit2014.md +++ b/docs/articles/nunit-analyzers/NUnit2014.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [SomeItemsConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ConstraintUsage/SomeItemsConstraintUsageAnalyzer.cs) +| Code | [SomeItemsConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ConstraintUsage/SomeItemsConstraintUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2015.md b/docs/articles/nunit-analyzers/NUnit2015.md index af08d6414..662f6c5ec 100644 --- a/docs/articles/nunit-analyzers/NUnit2015.md +++ b/docs/articles/nunit-analyzers/NUnit2015.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2016.md b/docs/articles/nunit-analyzers/NUnit2016.md index 55412f14e..62ab644a5 100644 --- a/docs/articles/nunit-analyzers/NUnit2016.md +++ b/docs/articles/nunit-analyzers/NUnit2016.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2017.md b/docs/articles/nunit-analyzers/NUnit2017.md index 81d4b5495..e59dba047 100644 --- a/docs/articles/nunit-analyzers/NUnit2017.md +++ b/docs/articles/nunit-analyzers/NUnit2017.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2018.md b/docs/articles/nunit-analyzers/NUnit2018.md index 4649f4593..e0bdf8ae7 100644 --- a/docs/articles/nunit-analyzers/NUnit2018.md +++ b/docs/articles/nunit-analyzers/NUnit2018.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2019.md b/docs/articles/nunit-analyzers/NUnit2019.md index 8cabbbaf3..8a2e47f1a 100644 --- a/docs/articles/nunit-analyzers/NUnit2019.md +++ b/docs/articles/nunit-analyzers/NUnit2019.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2020.md b/docs/articles/nunit-analyzers/NUnit2020.md index 75b469bcd..c0005f26e 100644 --- a/docs/articles/nunit-analyzers/NUnit2020.md +++ b/docs/articles/nunit-analyzers/NUnit2020.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [SameAsIncompatibleTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/SameAsIncompatibleTypes/SameAsIncompatibleTypesAnalyzer.cs) +| Code | [SameAsIncompatibleTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/SameAsIncompatibleTypes/SameAsIncompatibleTypesAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2021.md b/docs/articles/nunit-analyzers/NUnit2021.md index accb54689..3ed7f0391 100644 --- a/docs/articles/nunit-analyzers/NUnit2021.md +++ b/docs/articles/nunit-analyzers/NUnit2021.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [EqualToIncompatibleTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/EqualToIncompatibleTypes/EqualToIncompatibleTypesAnalyzer.cs) +| Code | [EqualToIncompatibleTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/EqualToIncompatibleTypes/EqualToIncompatibleTypesAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2022.md b/docs/articles/nunit-analyzers/NUnit2022.md index 9e64b557e..24b48558f 100644 --- a/docs/articles/nunit-analyzers/NUnit2022.md +++ b/docs/articles/nunit-analyzers/NUnit2022.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [MissingPropertyAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/MissingProperty/MissingPropertyAnalyzer.cs) +| Code | [MissingPropertyAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/MissingProperty/MissingPropertyAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2023.md b/docs/articles/nunit-analyzers/NUnit2023.md index 4d9087726..a2ffb37cc 100644 --- a/docs/articles/nunit-analyzers/NUnit2023.md +++ b/docs/articles/nunit-analyzers/NUnit2023.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [NullConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/NullConstraintUsage/NullConstraintUsageAnalyzer.cs) +| Code | [NullConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/NullConstraintUsage/NullConstraintUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2024.md b/docs/articles/nunit-analyzers/NUnit2024.md index 6901f1611..13232d93a 100644 --- a/docs/articles/nunit-analyzers/NUnit2024.md +++ b/docs/articles/nunit-analyzers/NUnit2024.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [StringConstraintWrongActualTypeAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/StringConstraintWrongActualType/StringConstraintWrongActualTypeAnalyzer.cs) +| Code | [StringConstraintWrongActualTypeAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/StringConstraintWrongActualType/StringConstraintWrongActualTypeAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2025.md b/docs/articles/nunit-analyzers/NUnit2025.md index 06f049327..d2aa5c4b4 100644 --- a/docs/articles/nunit-analyzers/NUnit2025.md +++ b/docs/articles/nunit-analyzers/NUnit2025.md @@ -8,7 +8,7 @@ | Severity | Hidden | Enabled | False | Category | Assertion -| Code | [ContainsConstraintWrongActualTypeAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ContainsConstraintWrongActualType/ContainsConstraintWrongActualTypeAnalyzer.cs) +| Code | [ContainsConstraintWrongActualTypeAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ContainsConstraintWrongActualType/ContainsConstraintWrongActualTypeAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2026.md b/docs/articles/nunit-analyzers/NUnit2026.md index 88b9d881c..1b3f06283 100644 --- a/docs/articles/nunit-analyzers/NUnit2026.md +++ b/docs/articles/nunit-analyzers/NUnit2026.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [SomeItemsIncompatibleTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/SomeItemsIncompatibleTypes/SomeItemsIncompatibleTypesAnalyzer.cs) +| Code | [SomeItemsIncompatibleTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/SomeItemsIncompatibleTypes/SomeItemsIncompatibleTypesAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2027.md b/docs/articles/nunit-analyzers/NUnit2027.md index c80dd2def..8084ad392 100644 --- a/docs/articles/nunit-analyzers/NUnit2027.md +++ b/docs/articles/nunit-analyzers/NUnit2027.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2028.md b/docs/articles/nunit-analyzers/NUnit2028.md index 7c65bbf3c..142fa0961 100644 --- a/docs/articles/nunit-analyzers/NUnit2028.md +++ b/docs/articles/nunit-analyzers/NUnit2028.md @@ -9,7 +9,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2029.md b/docs/articles/nunit-analyzers/NUnit2029.md index f1cd9961f..b7ff958a4 100644 --- a/docs/articles/nunit-analyzers/NUnit2029.md +++ b/docs/articles/nunit-analyzers/NUnit2029.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2030.md b/docs/articles/nunit-analyzers/NUnit2030.md index 592d3ccf9..ed5491cd9 100644 --- a/docs/articles/nunit-analyzers/NUnit2030.md +++ b/docs/articles/nunit-analyzers/NUnit2030.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2031.md b/docs/articles/nunit-analyzers/NUnit2031.md index a67bcbc6d..0cc53c3f4 100644 --- a/docs/articles/nunit-analyzers/NUnit2031.md +++ b/docs/articles/nunit-analyzers/NUnit2031.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2032.md b/docs/articles/nunit-analyzers/NUnit2032.md index 6d1af9daa..702802d52 100644 --- a/docs/articles/nunit-analyzers/NUnit2032.md +++ b/docs/articles/nunit-analyzers/NUnit2032.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2033.md b/docs/articles/nunit-analyzers/NUnit2033.md index 555474ef9..eb772efaf 100644 --- a/docs/articles/nunit-analyzers/NUnit2033.md +++ b/docs/articles/nunit-analyzers/NUnit2033.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2034.md b/docs/articles/nunit-analyzers/NUnit2034.md index 86b000239..bca002261 100644 --- a/docs/articles/nunit-analyzers/NUnit2034.md +++ b/docs/articles/nunit-analyzers/NUnit2034.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2035.md b/docs/articles/nunit-analyzers/NUnit2035.md index 015df1864..056618362 100644 --- a/docs/articles/nunit-analyzers/NUnit2035.md +++ b/docs/articles/nunit-analyzers/NUnit2035.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2036.md b/docs/articles/nunit-analyzers/NUnit2036.md index 18309e7f1..b12858bbb 100644 --- a/docs/articles/nunit-analyzers/NUnit2036.md +++ b/docs/articles/nunit-analyzers/NUnit2036.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2037.md b/docs/articles/nunit-analyzers/NUnit2037.md index 688b21410..39ade3a93 100644 --- a/docs/articles/nunit-analyzers/NUnit2037.md +++ b/docs/articles/nunit-analyzers/NUnit2037.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2038.md b/docs/articles/nunit-analyzers/NUnit2038.md index 956e5ecab..b1d834512 100644 --- a/docs/articles/nunit-analyzers/NUnit2038.md +++ b/docs/articles/nunit-analyzers/NUnit2038.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2039.md b/docs/articles/nunit-analyzers/NUnit2039.md index 065971297..6c8ff9053 100644 --- a/docs/articles/nunit-analyzers/NUnit2039.md +++ b/docs/articles/nunit-analyzers/NUnit2039.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2040.md b/docs/articles/nunit-analyzers/NUnit2040.md index a31cf7b74..123ef05db 100644 --- a/docs/articles/nunit-analyzers/NUnit2040.md +++ b/docs/articles/nunit-analyzers/NUnit2040.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [SameAsOnValueTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/SameAsOnValueTypes/SameAsOnValueTypesAnalyzer.cs) +| Code | [SameAsOnValueTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/SameAsOnValueTypes/SameAsOnValueTypesAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2041.md b/docs/articles/nunit-analyzers/NUnit2041.md index 1b1fdee82..a850f0067 100644 --- a/docs/articles/nunit-analyzers/NUnit2041.md +++ b/docs/articles/nunit-analyzers/NUnit2041.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [ComparableTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ComparableTypes/ComparableTypesAnalyzer.cs) +| Code | [ComparableTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ComparableTypes/ComparableTypesAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2042.md b/docs/articles/nunit-analyzers/NUnit2042.md index 9d5fde690..9266f37fc 100644 --- a/docs/articles/nunit-analyzers/NUnit2042.md +++ b/docs/articles/nunit-analyzers/NUnit2042.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ComparableTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ComparableTypes/ComparableTypesAnalyzer.cs) +| Code | [ComparableTypesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ComparableTypes/ComparableTypesAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2043.md b/docs/articles/nunit-analyzers/NUnit2043.md index e0b9f06be..329bc33b9 100644 --- a/docs/articles/nunit-analyzers/NUnit2043.md +++ b/docs/articles/nunit-analyzers/NUnit2043.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [ComparisonConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/ConstraintUsage/ComparisonConstraintUsageAnalyzer.cs) +| Code | [ComparisonConstraintUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ConstraintUsage/ComparisonConstraintUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2044.md b/docs/articles/nunit-analyzers/NUnit2044.md index b431c2b37..17db3e249 100644 --- a/docs/articles/nunit-analyzers/NUnit2044.md +++ b/docs/articles/nunit-analyzers/NUnit2044.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [DelegateRequiredAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DelegateRequired/DelegateRequiredAnalyzer.cs) +| Code | [DelegateRequiredAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DelegateRequired/DelegateRequiredAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2045.md b/docs/articles/nunit-analyzers/NUnit2045.md index 8981e6d2a..289b4a831 100644 --- a/docs/articles/nunit-analyzers/NUnit2045.md +++ b/docs/articles/nunit-analyzers/NUnit2045.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [UseAssertMultipleAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/UseAssertMultiple/UseAssertMultipleAnalyzer.cs) +| Code | [UseAssertMultipleAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/UseAssertMultiple/UseAssertMultipleAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2046.md b/docs/articles/nunit-analyzers/NUnit2046.md index 1d31bbb10..f6c1a58af 100644 --- a/docs/articles/nunit-analyzers/NUnit2046.md +++ b/docs/articles/nunit-analyzers/NUnit2046.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Assertion -| Code | [UseCollectionConstraintAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/UseCollectionConstraint/UseCollectionConstraintAnalyzer.cs) +| Code | [UseCollectionConstraintAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/UseCollectionConstraint/UseCollectionConstraintAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2047.md b/docs/articles/nunit-analyzers/NUnit2047.md index c7c04c5bf..068979cb6 100644 --- a/docs/articles/nunit-analyzers/NUnit2047.md +++ b/docs/articles/nunit-analyzers/NUnit2047.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [WithinUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/WithinUsage/WithinUsageAnalyzer.cs) +| Code | [WithinUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/WithinUsage/WithinUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2048.md b/docs/articles/nunit-analyzers/NUnit2048.md index d30e10ac5..625671757 100644 --- a/docs/articles/nunit-analyzers/NUnit2048.md +++ b/docs/articles/nunit-analyzers/NUnit2048.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [StringAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/StringAssertUsage/StringAssertUsageAnalyzer.cs) +| Code | [StringAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/StringAssertUsage/StringAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2049.md b/docs/articles/nunit-analyzers/NUnit2049.md index 635e24647..35a6414c5 100644 --- a/docs/articles/nunit-analyzers/NUnit2049.md +++ b/docs/articles/nunit-analyzers/NUnit2049.md @@ -8,7 +8,7 @@ | Severity | Warning | Enabled | True | Category | Assertion -| Code | [CollectionAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/CollectionAssertUsage/CollectionAssertUsageAnalyzer.cs) +| Code | [CollectionAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/CollectionAssertUsage/CollectionAssertUsageAnalyzer.cs) ## Description diff --git a/docs/articles/nunit-analyzers/NUnit2050.md b/docs/articles/nunit-analyzers/NUnit2050.md index cab959e5f..de09911fb 100644 --- a/docs/articles/nunit-analyzers/NUnit2050.md +++ b/docs/articles/nunit-analyzers/NUnit2050.md @@ -8,7 +8,7 @@ | Severity | Error | Enabled | True | Category | Assertion -| Code | [UpdateStringFormatToInterpolatableStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/UpdateStringFormatToInterpolatableString/UpdateStringFormatToInterpolatableStringAnalyzer.cs) +| Code | [UpdateStringFormatToInterpolatableStringAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/UpdateStringFormatToInterpolatableString/UpdateStringFormatToInterpolatableStringAnalyzer.cs) ## Description @@ -22,16 +22,29 @@ to include the expression passed in for the _actual_ and _constraint_ parameters These are parameters automatically supplied by the compiler. To facilitate this, we needed to drop support for -[composite formatting](https://learn.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting) +[composite formatting](https://learn.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting). All NUnit4 asserts only allow a single _message_ parameter which can be either a simple string literal -or a [interpolatable string](https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/string-interpolation) +or a [interpolatable string](https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/string-interpolation). This analyzer needs to be run when still building against NUnit3 as otherwise your code won't compile. When usages of the new methods with `params` are detected, the associated CodeFix will convert the format specification into an interpolated string. +The affected methods are: + +```csharp +Assert.Pass +Assert.Fail +Assert.Warn +Assert.Ignore +Assert.Inconclusive +Assert.That +Assume.That +``` + Once you moved to NUnit4 the analyzer has some limited functionality as there are a few -cases where your NUnit3 code will compile on NUnit4, but not the way you want it. +cases with `Assert.That` or `Assume.That` where your NUnit3 code will compile on NUnit4, +but not the way you want it. Here what you think are parameters to a format specification are actually interpreted as the _actual_ and _constraint_ expression strings. Unfortunately you only find that out when the test fails, which could be never. @@ -99,7 +112,7 @@ When using NUnit3, this results in: But when using NUnit4, we get: ```plaintext - Message:  + Message: Expected '{0}', but got: '{1}' Assert.That(NUnit 3, NUnit 4) String lengths are both 7. Strings differ at index 6. @@ -122,7 +135,7 @@ public void TestMessage(string actual, string expected) and the output: ```plaintext - Message:  + Message: Expected 'NUnit 3', but got: 'NUnit 4' Assert.That(actual, Is.EqualTo(expected)) String lengths are both 7. Strings differ at index 6. diff --git a/docs/articles/nunit-analyzers/NUnit2051.md b/docs/articles/nunit-analyzers/NUnit2051.md new file mode 100644 index 000000000..e8f6d97f6 --- /dev/null +++ b/docs/articles/nunit-analyzers/NUnit2051.md @@ -0,0 +1,82 @@ +# NUnit2051 + +## Consider using Assert.That(expr, Is.Positive) instead of ClassicAssert.Positive(expr) + +| Topic | Value +| :-- | :-- +| Id | NUnit2051 +| Severity | Info +| Enabled | True +| Category | Assertion +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) + +## Description + +Consider using the constraint model, `Assert.That(expr, Is.Positive)`, instead of the classic model, +`ClassicAssert.Positive(expr)`. + +## Motivation + +The classic Assert model contains less flexibility than the constraint model, +so this analyzer marks usages of `ClassicAssert.Positive` from the classic Assert model. + +```csharp +[Test] +public void Test() +{ + ClassicAssert.Positive(expression); +} +``` + +## How to fix violations + +The analyzer comes with a code fix that will replace `ClassicAssert.Positive(expression)` with +`Assert.That(expression, Is.Positive)`. So the code block above will be changed into. + +```csharp +[Test] +public void Test() +{ + Assert.That(expression, Is.Positive); +} +``` + + +## Configure severity + +### 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). + +### Via .editorconfig file + +```ini +# NUnit2051: Consider using Assert.That(expr, Is.Positive) instead of ClassicAssert.Positive(expr) +dotnet_diagnostic.NUnit2051.severity = chosenSeverity +``` + +where `chosenSeverity` can be one of `none`, `silent`, `suggestion`, `warning`, or `error`. + +### Via #pragma directive + +```csharp +#pragma warning disable NUnit2051 // Consider using Assert.That(expr, Is.Positive) instead of ClassicAssert.Positive(expr) +Code violating the rule here +#pragma warning restore NUnit2051 // Consider using Assert.That(expr, Is.Positive) instead of ClassicAssert.Positive(expr) +``` + +Or put this at the top of the file to disable all instances. + +```csharp +#pragma warning disable NUnit2051 // Consider using Assert.That(expr, Is.Positive) instead of ClassicAssert.Positive(expr) +``` + +### Via attribute `[SuppressMessage]` + +```csharp +[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertion", + "NUnit2051:Consider using Assert.That(expr, Is.Positive) instead of ClassicAssert.Positive(expr)", + Justification = "Reason...")] +``` + diff --git a/docs/articles/nunit-analyzers/NUnit2052.md b/docs/articles/nunit-analyzers/NUnit2052.md new file mode 100644 index 000000000..1e4cb1310 --- /dev/null +++ b/docs/articles/nunit-analyzers/NUnit2052.md @@ -0,0 +1,82 @@ +# NUnit2052 + +## Consider using Assert.That(expr, Is.Negative) instead of ClassicAssert.Negative(expr) + +| Topic | Value +| :-- | :-- +| Id | NUnit2052 +| Severity | Info +| Enabled | True +| Category | Assertion +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) + +## Description + +Consider using the constraint model, `Assert.That(expr, Is.Negative)`, instead of the classic model, +`ClassicAssert.Negative(expr)`. + +## Motivation + +The classic Assert model contains less flexibility than the constraint model, +so this analyzer marks usages of `ClassicAssert.Negative` from the classic Assert model. + +```csharp +[Test] +public void Test() +{ + ClassicAssert.Negative(expression); +} +``` + +## How to fix violations + +The analyzer comes with a code fix that will replace `ClassicAssert.Negative(expression)` with +`Assert.That(expression, Is.Negative)`. So the code block above will be changed into. + +```csharp +[Test] +public void Test() +{ + Assert.That(expression, Is.Negative); +} +``` + + +## Configure severity + +### 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). + +### Via .editorconfig file + +```ini +# NUnit2052: Consider using Assert.That(expr, Is.Negative) instead of ClassicAssert.Negative(expr) +dotnet_diagnostic.NUnit2052.severity = chosenSeverity +``` + +where `chosenSeverity` can be one of `none`, `silent`, `suggestion`, `warning`, or `error`. + +### Via #pragma directive + +```csharp +#pragma warning disable NUnit2052 // Consider using Assert.That(expr, Is.Negative) instead of ClassicAssert.Negative(expr) +Code violating the rule here +#pragma warning restore NUnit2052 // Consider using Assert.That(expr, Is.Negative) instead of ClassicAssert.Negative(expr) +``` + +Or put this at the top of the file to disable all instances. + +```csharp +#pragma warning disable NUnit2052 // Consider using Assert.That(expr, Is.Negative) instead of ClassicAssert.Negative(expr) +``` + +### Via attribute `[SuppressMessage]` + +```csharp +[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertion", + "NUnit2052:Consider using Assert.That(expr, Is.Negative) instead of ClassicAssert.Negative(expr)", + Justification = "Reason...")] +``` + diff --git a/docs/articles/nunit-analyzers/NUnit2053.md b/docs/articles/nunit-analyzers/NUnit2053.md new file mode 100644 index 000000000..20f9a9d11 --- /dev/null +++ b/docs/articles/nunit-analyzers/NUnit2053.md @@ -0,0 +1,82 @@ +# NUnit2053 + +## Consider using Assert.That(actual, Is.AssignableFrom(expected)) instead of ClassicAssert.IsAssignableFrom(expected, actual) + +| Topic | Value +| :-- | :-- +| Id | NUnit2053 +| Severity | Info +| Enabled | True +| Category | Assertion +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) + +## Description + +Consider using the constraint model, `Assert.That(actual, Is.AssignableFrom(expected))`, instead of the classic model, +`ClassicAssert.IsAssignableFrom(expected, actual)`. + +## Motivation + +The assert `ClassicAssert.IsAssignableFrom` from the classic Assert model makes it easy to confuse the `expected` and the +`actual` argument, so this analyzer marks usages of `ClassicAssert.IsAssignableFrom`. + +```csharp +[Test] +public void Test() +{ + ClassicAssert.IsAssignableFrom(expected, actual); +} +``` + +## How to fix violations + +The analyzer comes with a code fix that will replace `ClassicAssert.IsAssignableFrom(expected, actual)` with +`Assert.That(actual, Is.AssignableFrom(expected))`. So the code block above will be changed into. + +```csharp +[Test] +public void Test() +{ + Assert.That(actual, Is.AssignableFrom(expected)); +} +``` + + +## Configure severity + +### 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). + +### Via .editorconfig file + +```ini +# NUnit2053: Consider using Assert.That(actual, Is.AssignableFrom(expected)) instead of ClassicAssert.IsAssignableFrom(expected, actual) +dotnet_diagnostic.NUnit2053.severity = chosenSeverity +``` + +where `chosenSeverity` can be one of `none`, `silent`, `suggestion`, `warning`, or `error`. + +### Via #pragma directive + +```csharp +#pragma warning disable NUnit2053 // Consider using Assert.That(actual, Is.AssignableFrom(expected)) instead of ClassicAssert.IsAssignableFrom(expected, actual) +Code violating the rule here +#pragma warning restore NUnit2053 // Consider using Assert.That(actual, Is.AssignableFrom(expected)) instead of ClassicAssert.IsAssignableFrom(expected, actual) +``` + +Or put this at the top of the file to disable all instances. + +```csharp +#pragma warning disable NUnit2053 // Consider using Assert.That(actual, Is.AssignableFrom(expected)) instead of ClassicAssert.IsAssignableFrom(expected, actual) +``` + +### Via attribute `[SuppressMessage]` + +```csharp +[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertion", + "NUnit2053:Consider using Assert.That(actual, Is.AssignableFrom(expected)) instead of ClassicAssert.IsAssignableFrom(expected, actual)", + Justification = "Reason...")] +``` + diff --git a/docs/articles/nunit-analyzers/NUnit2054.md b/docs/articles/nunit-analyzers/NUnit2054.md new file mode 100644 index 000000000..f2587b525 --- /dev/null +++ b/docs/articles/nunit-analyzers/NUnit2054.md @@ -0,0 +1,83 @@ +# NUnit2054 + + +## Consider using Assert.That(actual, Is.Not.AssignableFrom(expected)) instead of ClassicAssert.IsNotAssignableFrom(expected, actual) + +| Topic | Value +| :-- | :-- +| Id | NUnit2054 +| Severity | Info +| Enabled | True +| Category | Assertion +| Code | [ClassicModelAssertUsageAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/ClassicModelAssertUsage/ClassicModelAssertUsageAnalyzer.cs) + +## Description + +Consider using the constraint model, `Assert.That(actual, Is.Not.AssignableFrom(expected))`, instead of the classic model, +`ClassicAssert.IsNotAssignableFrom(expected, actual)`. + +## Motivation + +The assert `ClassicAssert.IsNotAssignableFrom` from the classic Assert model makes it easy to confuse the `expected` +and the `actual` argument, so this analyzer marks usages of `ClassicAssert.IsNotAssignableFrom`. + +```csharp +[Test] +public void Test() +{ + ClassicAssert.IsNotAssignableFrom(expected, actual); +} +``` + +## How to fix violations + +The analyzer comes with a code fix that will replace `ClassicAssert.IsNotAssignableFrom(expected, actual)` with +`Assert.That(actual, Is.Not.AssignableFrom(expected))`. So the code block above will be changed into. + +```csharp +[Test] +public void Test() +{ + Assert.That(actual, Is.Not.AssignableFrom(expected)); +} +``` + + +## Configure severity + +### 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). + +### Via .editorconfig file + +```ini +# NUnit2054: Consider using Assert.That(actual, Is.Not.AssignableFrom(expected)) instead of ClassicAssert.IsNotAssignableFrom(expected, actual) +dotnet_diagnostic.NUnit2054.severity = chosenSeverity +``` + +where `chosenSeverity` can be one of `none`, `silent`, `suggestion`, `warning`, or `error`. + +### Via #pragma directive + +```csharp +#pragma warning disable NUnit2054 // Consider using Assert.That(actual, Is.Not.AssignableFrom(expected)) instead of ClassicAssert.IsNotAssignableFrom(expected, actual) +Code violating the rule here +#pragma warning restore NUnit2054 // Consider using Assert.That(actual, Is.Not.AssignableFrom(expected)) instead of ClassicAssert.IsNotAssignableFrom(expected, actual) +``` + +Or put this at the top of the file to disable all instances. + +```csharp +#pragma warning disable NUnit2054 // Consider using Assert.That(actual, Is.Not.AssignableFrom(expected)) instead of ClassicAssert.IsNotAssignableFrom(expected, actual) +``` + +### Via attribute `[SuppressMessage]` + +```csharp +[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertion", + "NUnit2054:Consider using Assert.That(actual, Is.Not.AssignableFrom(expected)) instead of ClassicAssert.IsNotAssignableFrom(expected, actual)", + Justification = "Reason...")] +``` + diff --git a/docs/articles/nunit-analyzers/NUnit3001.md b/docs/articles/nunit-analyzers/NUnit3001.md index ec4857441..68bac5b0a 100644 --- a/docs/articles/nunit-analyzers/NUnit3001.md +++ b/docs/articles/nunit-analyzers/NUnit3001.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Suppressor -| Code | [DereferencePossiblyNullReferenceSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/DereferencePossiblyNullReferenceSuppressor.cs) +| Code | [DereferencePossiblyNullReferenceSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/DereferencePossiblyNullReferenceSuppressor.cs) ## Description @@ -90,7 +90,7 @@ The rule has no severity, but can be disabled. ### Via ruleset file To disable the rule for a project, you need to add a -[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) +[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) ```xml diff --git a/docs/articles/nunit-analyzers/NUnit3002.md b/docs/articles/nunit-analyzers/NUnit3002.md index 5e4fe6dde..546ce9217 100644 --- a/docs/articles/nunit-analyzers/NUnit3002.md +++ b/docs/articles/nunit-analyzers/NUnit3002.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Suppressor -| Code | [NonNullableFieldOrPropertyIsUninitializedSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/NonNullableFieldOrPropertyIsUninitializedSuppressor.cs) +| Code | [NonNullableFieldOrPropertyIsUninitializedSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/NonNullableFieldOrPropertyIsUninitializedSuppressor.cs) ## Description @@ -62,7 +62,7 @@ The rule has no severity, but can be disabled. ### Via ruleset file To disable the rule for a project, you need to add a -[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) +[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) ```xml diff --git a/docs/articles/nunit-analyzers/NUnit3003.md b/docs/articles/nunit-analyzers/NUnit3003.md index 85fc35209..e2283af50 100644 --- a/docs/articles/nunit-analyzers/NUnit3003.md +++ b/docs/articles/nunit-analyzers/NUnit3003.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Suppressor -| Code | [AvoidUninstantiatedInternalClassSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/AvoidUninstantiatedInternalClassSuppressor.cs) +| Code | [AvoidUninstantiatedInternalClassSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/AvoidUninstantiatedInternalClassSuppressor.cs) ## Description @@ -30,7 +30,7 @@ The rule has no severity, but can be disabled. ### Via ruleset file To disable the rule for a project, you need to add a -[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) +[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) ```xml diff --git a/docs/articles/nunit-analyzers/NUnit3004.md b/docs/articles/nunit-analyzers/NUnit3004.md index 551a37f4e..da3817a62 100644 --- a/docs/articles/nunit-analyzers/NUnit3004.md +++ b/docs/articles/nunit-analyzers/NUnit3004.md @@ -8,7 +8,7 @@ | Severity | Info | Enabled | True | Category | Suppressor -| Code | [TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor.cs) +| Code | [TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor.cs) ## Description @@ -36,7 +36,7 @@ The rule has no severity, but can be disabled. ### Via ruleset file To disable the rule for a project, you need to add a -[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.1.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) +[ruleset file](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/DiagnosticSuppressors/NUnit.Analyzers.Suppressions.ruleset) ```xml diff --git a/docs/articles/nunit-analyzers/NUnit4001.md b/docs/articles/nunit-analyzers/NUnit4001.md new file mode 100644 index 000000000..560f3ad4a --- /dev/null +++ b/docs/articles/nunit-analyzers/NUnit4001.md @@ -0,0 +1,78 @@ +# NUnit4001 + +## Simplify the Values attribute + +| Topic | Value +| :-- | :-- +| Id | NUnit4001 +| Severity | Info +| Enabled | True +| Category | Style +| Code | [SimplifyValuesAnalyzer](https://github.com/nunit/nunit.analyzers/blob/4.4.0/src/nunit.analyzers/SimplifyValues/SimplifyValuesAnalyzer.cs) + +## Description + +Consider removing unnecessary parameters from the ValuesAttribute. + +## Motivation + +When used without any arguments, the [Values] attribute on a (nullable) boolean or an (nullable) enum parameter +will automatically include all possible values. + +Therefore the `Values` attribute like + +```csharp +[Test] +public void MyBoolTest([Values(true, false)] bool value) { /* ... */ } +``` + +can be simplified to + +```csharp +[Test] +public void MyBoolTest([Values] bool value) { /* ... */ } +``` + +## How to fix violations + +Remove all arguments of the `Values` attribute. + + +## Configure severity + +### 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). + +### Via .editorconfig file + +```ini +# NUnit4001: Simplify the Values attribute +dotnet_diagnostic.NUnit4001.severity = chosenSeverity +``` + +where `chosenSeverity` can be one of `none`, `silent`, `suggestion`, `warning`, or `error`. + +### Via #pragma directive + +```csharp +#pragma warning disable NUnit4001 // Simplify the Values attribute +Code violating the rule here +#pragma warning restore NUnit4001 // Simplify the Values attribute +``` + +Or put this at the top of the file to disable all instances. + +```csharp +#pragma warning disable NUnit4001 // Simplify the Values attribute +``` + +### Via attribute `[SuppressMessage]` + +```csharp +[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", + "NUnit4001:Simplify the Values attribute", + Justification = "Reason...")] +``` + diff --git a/docs/articles/nunit-analyzers/toc.yml b/docs/articles/nunit-analyzers/toc.yml index c894ff37e..e33e08a8d 100644 --- a/docs/articles/nunit-analyzers/toc.yml +++ b/docs/articles/nunit-analyzers/toc.yml @@ -65,6 +65,8 @@ href: NUnit1031.md - name: NUnit1032 href: NUnit1032.md + - name: NUnit1033 + href: NUnit1033.md - name: NUnit2001 href: NUnit2001.md - name: NUnit2002 @@ -165,6 +167,14 @@ href: NUnit2049.md - name: NUnit2050 href: NUnit2050.md + - name: NUnit2051 + href: NUnit2051.md + - name: NUnit2052 + href: NUnit2052.md + - name: NUnit2053 + href: NUnit2053.md + - name: NUnit2054 + href: NUnit2054.md - name: NUnit3001 href: NUnit3001.md - name: NUnit3002 @@ -172,4 +182,6 @@ - name: NUnit3003 href: NUnit3003.md - name: NUnit3004 - href: NUnit3004.md \ No newline at end of file + href: NUnit3004.md + - name: NUnit4001 + href: NUnit4001.md \ No newline at end of file