From da305a21eb19af5c8c0bb67dcb5572ccf70e4d8b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 20:00:29 +0000 Subject: [PATCH 1/2] Initial plan From c5534f7bfb9a245cc053da7fc474dbd93496b357 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 20:04:05 +0000 Subject: [PATCH 2/2] Add missing periods to tables and lists in analyzer rules documentation Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com> --- .../testing/mstest-analyzers/design-rules.md | 52 +++--- .../mstest-analyzers/performance-rules.md | 4 +- .../mstest-analyzers/suppression-rules.md | 6 +- .../testing/mstest-analyzers/usage-rules.md | 176 +++++++++--------- 4 files changed, 119 insertions(+), 119 deletions(-) diff --git a/docs/core/testing/mstest-analyzers/design-rules.md b/docs/core/testing/mstest-analyzers/design-rules.md index cfc66b966ae83..092862f670f44 100644 --- a/docs/core/testing/mstest-analyzers/design-rules.md +++ b/docs/core/testing/mstest-analyzers/design-rules.md @@ -14,19 +14,19 @@ Design rules help you create and maintain test suites that adhere to proper desi | Rule ID | Title | Severity | Fix Available | |---------|-------|----------|---------------| -| [MSTEST0004](mstest0004.md) | Public types should be test classes | Info | Yes | -| [MSTEST0006](mstest0006.md) | Avoid ExpectedException attribute | Info | Yes | -| [MSTEST0015](mstest0015.md) | Test method should not be ignored | None (opt-in) | No | -| [MSTEST0016](mstest0016.md) | Test class should have test method | Info | No | -| [MSTEST0019](mstest0019.md) | Prefer TestInitialize over constructors | None (opt-in) | Yes | -| [MSTEST0020](mstest0020.md) | Prefer constructors over TestInitialize | None (opt-in) | Yes | -| [MSTEST0021](mstest0021.md) | Prefer Dispose over TestCleanup | None (opt-in) | Yes | -| [MSTEST0022](mstest0022.md) | Prefer TestCleanup over Dispose | None (opt-in) | Yes | -| [MSTEST0025](mstest0025.md) | Prefer Assert.Fail over always-false conditions | Info | Yes | -| [MSTEST0029](mstest0029.md) | Public method should be test method | Info | Yes | -| [MSTEST0036](mstest0036.md) | Do not use shadowing | Warning | No | -| [MSTEST0044](mstest0044.md) | Prefer TestMethod over DataTestMethod | Info | Yes | -| [MSTEST0045](mstest0045.md) | Use cooperative cancellation for timeout | Info | Yes | +| [MSTEST0004](mstest0004.md) | Public types should be test classes. | Info | Yes | +| [MSTEST0006](mstest0006.md) | Avoid ExpectedException attribute. | Info | Yes | +| [MSTEST0015](mstest0015.md) | Test method should not be ignored. | None (opt-in) | No | +| [MSTEST0016](mstest0016.md) | Test class should have test method. | Info | No | +| [MSTEST0019](mstest0019.md) | Prefer TestInitialize over constructors. | None (opt-in) | Yes | +| [MSTEST0020](mstest0020.md) | Prefer constructors over TestInitialize. | None (opt-in) | Yes | +| [MSTEST0021](mstest0021.md) | Prefer Dispose over TestCleanup. | None (opt-in) | Yes | +| [MSTEST0022](mstest0022.md) | Prefer TestCleanup over Dispose. | None (opt-in) | Yes | +| [MSTEST0025](mstest0025.md) | Prefer Assert.Fail over always-false conditions. | Info | Yes | +| [MSTEST0029](mstest0029.md) | Public method should be test method. | Info | Yes | +| [MSTEST0036](mstest0036.md) | Do not use shadowing. | Warning | No | +| [MSTEST0044](mstest0044.md) | Prefer TestMethod over DataTestMethod. | Info | Yes | +| [MSTEST0045](mstest0045.md) | Use cooperative cancellation for timeout. | Info | Yes | ## Common scenarios @@ -34,35 +34,35 @@ Design rules help you create and maintain test suites that adhere to proper desi When creating test classes, these rules help ensure proper design: -- **[MSTEST0004](mstest0004.md)**: Keep helper classes internal, only test classes should be public -- **[MSTEST0016](mstest0016.md)**: Ensure test classes contain at least one test method -- **[MSTEST0029](mstest0029.md)**: Public methods in test classes should be test methods +- **[MSTEST0004](mstest0004.md)**: Keep helper classes internal, only test classes should be public. +- **[MSTEST0016](mstest0016.md)**: Ensure test classes contain at least one test method. +- **[MSTEST0029](mstest0029.md)**: Public methods in test classes should be test methods. ### Initialization patterns MSTest supports both constructors and TestInitialize methods. These mutually exclusive rules let you enforce a consistent pattern: -- **[MSTEST0019](mstest0019.md)**: Enforce TestInitialize for initialization (useful for async scenarios) -- **[MSTEST0020](mstest0020.md)**: Enforce constructors for initialization (better for readonly fields) +- **[MSTEST0019](mstest0019.md)**: Enforce TestInitialize for initialization (useful for async scenarios). +- **[MSTEST0020](mstest0020.md)**: Enforce constructors for initialization (better for readonly fields). ### Cleanup patterns Similarly, choose between Dispose and TestCleanup: -- **[MSTEST0021](mstest0021.md)**: Enforce Dispose pattern for cleanup -- **[MSTEST0022](mstest0022.md)**: Enforce TestCleanup for cleanup +- **[MSTEST0021](mstest0021.md)**: Enforce Dispose pattern for cleanup. +- **[MSTEST0022](mstest0022.md)**: Enforce TestCleanup for cleanup. ### Better assertions -- **[MSTEST0006](mstest0006.md)**: Use Assert.ThrowsExactly instead of [ExpectedException] for better precision -- **[MSTEST0025](mstest0025.md)**: Use Assert.Fail instead of Assert.IsTrue(false) +- **[MSTEST0006](mstest0006.md)**: Use Assert.ThrowsExactly instead of [ExpectedException] for better precision. +- **[MSTEST0025](mstest0025.md)**: Use Assert.Fail instead of Assert.IsTrue(false). ### Test quality -- **[MSTEST0015](mstest0015.md)**: Flag ignored tests (opt-in rule) -- **[MSTEST0036](mstest0036.md)**: Avoid shadowing base class members -- **[MSTEST0044](mstest0044.md)**: Use TestMethod unless data-driven testing is needed -- **[MSTEST0045](mstest0045.md)**: Enable cancellation tokens for timeout handling +- **[MSTEST0015](mstest0015.md)**: Flag ignored tests (opt-in rule). +- **[MSTEST0036](mstest0036.md)**: Avoid shadowing base class members. +- **[MSTEST0044](mstest0044.md)**: Use TestMethod unless data-driven testing is needed. +- **[MSTEST0045](mstest0045.md)**: Enable cancellation tokens for timeout handling. ## Related documentation diff --git a/docs/core/testing/mstest-analyzers/performance-rules.md b/docs/core/testing/mstest-analyzers/performance-rules.md index 67780fd1f07a6..3c6814b07a0b1 100644 --- a/docs/core/testing/mstest-analyzers/performance-rules.md +++ b/docs/core/testing/mstest-analyzers/performance-rules.md @@ -14,7 +14,7 @@ Performance rules support high-performance testing by identifying opportunities | Rule ID | Title | Severity | Fix Available | |---------|-------|----------|---------------| -| [MSTEST0001](mstest0001.md) | Use Parallelize attribute | Info | Yes | +| [MSTEST0001](mstest0001.md) | Use Parallelize attribute. | Info | Yes | ## Common scenarios @@ -22,7 +22,7 @@ Performance rules support high-performance testing by identifying opportunities By default, MSTest runs tests sequentially, which can significantly impact execution time for large test suites. -- **[MSTEST0001](mstest0001.md)**: Reminds you to explicitly enable parallelization with `[assembly: Parallelize]` or acknowledge sequential execution with `[assembly: DoNotParallelize]` +- **[MSTEST0001](mstest0001.md)**: Reminds you to explicitly enable parallelization with `[assembly: Parallelize]` or acknowledge sequential execution with `[assembly: DoNotParallelize]`. **Why this matters**: Parallelization can dramatically reduce test execution time by running tests concurrently across multiple threads or processes. However, not all test suites are safe to parallelize (for example, tests that modify shared state). This rule ensures you make a conscious decision about parallelization. diff --git a/docs/core/testing/mstest-analyzers/suppression-rules.md b/docs/core/testing/mstest-analyzers/suppression-rules.md index 830f1c51c5d86..c6c665ed534ab 100644 --- a/docs/core/testing/mstest-analyzers/suppression-rules.md +++ b/docs/core/testing/mstest-analyzers/suppression-rules.md @@ -14,9 +14,9 @@ Suppression rules automatically suppress diagnostics from other analyzers (like | Rule ID | Title | Suppresses | |---------|-------|------------| -| [MSTEST0027](mstest0027.md) | Suppress async suffix for test methods | VSTHRD200 | -| [MSTEST0028](mstest0028.md) | Suppress async suffix for test fixture methods | VSTHRD200 | -| [MSTEST0033](mstest0033.md) | Suppress non-nullable reference not initialized | CS8618 | +| [MSTEST0027](mstest0027.md) | Suppress async suffix for test methods. | VSTHRD200 | +| [MSTEST0028](mstest0028.md) | Suppress async suffix for test fixture methods. | VSTHRD200 | +| [MSTEST0033](mstest0033.md) | Suppress non-nullable reference not initialized. | CS8618 | ## How suppression rules work diff --git a/docs/core/testing/mstest-analyzers/usage-rules.md b/docs/core/testing/mstest-analyzers/usage-rules.md index 4faec0a7a5dc3..393f5b9583a5d 100644 --- a/docs/core/testing/mstest-analyzers/usage-rules.md +++ b/docs/core/testing/mstest-analyzers/usage-rules.md @@ -14,50 +14,50 @@ Usage rules support proper usage of MSTest attributes, methods, and patterns. Th | Rule ID | Title | Severity | Fix Available | |---------|-------|----------|---------------| -| [MSTEST0002](mstest0002.md) | Test class should be valid | Warning | Yes | -| [MSTEST0003](mstest0003.md) | Test method should be valid | Warning → Error* | Yes | -| [MSTEST0005](mstest0005.md) | TestContext should be valid | Warning | Yes | -| [MSTEST0007](mstest0007.md) | Use attribute on test method | Warning | No | -| [MSTEST0008](mstest0008.md) | TestInitialize should be valid | Warning | Yes | -| [MSTEST0009](mstest0009.md) | TestCleanup should be valid | Warning | Yes | -| [MSTEST0010](mstest0010.md) | ClassInitialize should be valid | Warning | Yes | -| [MSTEST0011](mstest0011.md) | ClassCleanup should be valid | Warning | Yes | -| [MSTEST0012](mstest0012.md) | AssemblyInitialize should be valid | Warning | Yes | -| [MSTEST0013](mstest0013.md) | AssemblyCleanup should be valid | Warning | Yes | -| [MSTEST0014](mstest0014.md) | DataRow should be valid | Warning | Yes | -| [MSTEST0017](mstest0017.md) | Assertion args should be passed in correct order | Info | Yes | -| [MSTEST0018](mstest0018.md) | DynamicData should be valid | Warning | Yes | -| [MSTEST0023](mstest0023.md) | Do not negate boolean assertion | Info | Yes | -| [MSTEST0024](mstest0024.md) | Do not store static TestContext | Warning | No | -| [MSTEST0026](mstest0026.md) | Assertion args should avoid conditional access | Info | No | -| [MSTEST0030](mstest0030.md) | Type containing test method should be a test class | Warning | Yes | -| [MSTEST0031](mstest0031.md) | Do not use System.ComponentModel.DescriptionAttribute | Info | Yes | -| [MSTEST0032](mstest0032.md) | Review always-true assert condition | Info | No | -| [MSTEST0034](mstest0034.md) | Use ClassCleanupBehavior.EndOfClass | Info | Yes | -| [MSTEST0035](mstest0035.md) | Use DeploymentItem with test method or test class | Info | No | -| [MSTEST0037](mstest0037.md) | Use proper assert methods | Info | Yes | -| [MSTEST0038](mstest0038.md) | Avoid Assert.AreSame with value types | Info | Yes | -| [MSTEST0039](mstest0039.md) | Use newer Assert.Throws methods | Info | Yes | -| [MSTEST0040](mstest0040.md) | Avoid using asserts in async void context | Warning | No | -| [MSTEST0041](mstest0041.md) | Use condition-based attributes with test class | Warning | No | -| [MSTEST0042](mstest0042.md) | Duplicate DataRow | Warning | No | -| [MSTEST0043](mstest0043.md) | Use retry attribute on test method | Warning → Error* | Yes | -| [MSTEST0046](mstest0046.md) | Use Assert instead of StringAssert | Info | Yes | -| [MSTEST0048](mstest0048.md) | TestContext property usage | Warning | No | -| [MSTEST0049](mstest0049.md) | Flow TestContext CancellationToken | Info | Yes | -| [MSTEST0050](mstest0050.md) | Global test fixture should be valid | Warning | Yes | -| [MSTEST0051](mstest0051.md) | Assert.Throws should contain single statement | Info | Yes | -| [MSTEST0052](mstest0052.md) | Avoid explicit DynamicDataSourceType | Info | Yes | -| [MSTEST0053](mstest0053.md) | Avoid Assert format parameters | Info | Yes | -| [MSTEST0054](mstest0054.md) | Use CancellationToken property | Info | Yes | -| [MSTEST0055](mstest0055.md) | Do not ignore string method return value | Warning | No | -| [MSTEST0056](mstest0056.md) | TestMethodAttribute should set DisplayName correctly | Info | Yes | -| [MSTEST0057](mstest0057.md) | TestMethodAttribute should propagate source information | Warning | No | -| [MSTEST0058](mstest0058.md) | Avoid asserts in catch blocks | Info | No | -| [MSTEST0059](mstest0059.md) | Use Parallelize attribute correctly | Warning | No | -| [MSTEST0060](mstest0060.md) | Duplicate TestMethodAttribute | Warning | Yes | -| [MSTEST0061](mstest0061.md) | Use OSCondition attribute instead of runtime check | Info | Yes | -| [MSTEST0062](mstest0062.md) | Avoid out/ref test method parameters | Warning | Yes | +| [MSTEST0002](mstest0002.md) | Test class should be valid. | Warning | Yes | +| [MSTEST0003](mstest0003.md) | Test method should be valid. | Warning → Error* | Yes | +| [MSTEST0005](mstest0005.md) | TestContext should be valid. | Warning | Yes | +| [MSTEST0007](mstest0007.md) | Use attribute on test method. | Warning | No | +| [MSTEST0008](mstest0008.md) | TestInitialize should be valid. | Warning | Yes | +| [MSTEST0009](mstest0009.md) | TestCleanup should be valid. | Warning | Yes | +| [MSTEST0010](mstest0010.md) | ClassInitialize should be valid. | Warning | Yes | +| [MSTEST0011](mstest0011.md) | ClassCleanup should be valid. | Warning | Yes | +| [MSTEST0012](mstest0012.md) | AssemblyInitialize should be valid. | Warning | Yes | +| [MSTEST0013](mstest0013.md) | AssemblyCleanup should be valid. | Warning | Yes | +| [MSTEST0014](mstest0014.md) | DataRow should be valid. | Warning | Yes | +| [MSTEST0017](mstest0017.md) | Assertion args should be passed in correct order. | Info | Yes | +| [MSTEST0018](mstest0018.md) | DynamicData should be valid. | Warning | Yes | +| [MSTEST0023](mstest0023.md) | Do not negate boolean assertion. | Info | Yes | +| [MSTEST0024](mstest0024.md) | Do not store static TestContext. | Warning | No | +| [MSTEST0026](mstest0026.md) | Assertion args should avoid conditional access. | Info | No | +| [MSTEST0030](mstest0030.md) | Type containing test method should be a test class. | Warning | Yes | +| [MSTEST0031](mstest0031.md) | Do not use System.ComponentModel.DescriptionAttribute. | Info | Yes | +| [MSTEST0032](mstest0032.md) | Review always-true assert condition. | Info | No | +| [MSTEST0034](mstest0034.md) | Use ClassCleanupBehavior.EndOfClass. | Info | Yes | +| [MSTEST0035](mstest0035.md) | Use DeploymentItem with test method or test class. | Info | No | +| [MSTEST0037](mstest0037.md) | Use proper assert methods. | Info | Yes | +| [MSTEST0038](mstest0038.md) | Avoid Assert.AreSame with value types. | Info | Yes | +| [MSTEST0039](mstest0039.md) | Use newer Assert.Throws methods. | Info | Yes | +| [MSTEST0040](mstest0040.md) | Avoid using asserts in async void context. | Warning | No | +| [MSTEST0041](mstest0041.md) | Use condition-based attributes with test class. | Warning | No | +| [MSTEST0042](mstest0042.md) | Duplicate DataRow. | Warning | No | +| [MSTEST0043](mstest0043.md) | Use retry attribute on test method. | Warning → Error* | Yes | +| [MSTEST0046](mstest0046.md) | Use Assert instead of StringAssert. | Info | Yes | +| [MSTEST0048](mstest0048.md) | TestContext property usage. | Warning | No | +| [MSTEST0049](mstest0049.md) | Flow TestContext CancellationToken. | Info | Yes | +| [MSTEST0050](mstest0050.md) | Global test fixture should be valid. | Warning | Yes | +| [MSTEST0051](mstest0051.md) | Assert.Throws should contain single statement. | Info | Yes | +| [MSTEST0052](mstest0052.md) | Avoid explicit DynamicDataSourceType. | Info | Yes | +| [MSTEST0053](mstest0053.md) | Avoid Assert format parameters. | Info | Yes | +| [MSTEST0054](mstest0054.md) | Use CancellationToken property. | Info | Yes | +| [MSTEST0055](mstest0055.md) | Do not ignore string method return value. | Warning | No | +| [MSTEST0056](mstest0056.md) | TestMethodAttribute should set DisplayName correctly. | Info | Yes | +| [MSTEST0057](mstest0057.md) | TestMethodAttribute should propagate source information. | Warning | No | +| [MSTEST0058](mstest0058.md) | Avoid asserts in catch blocks. | Info | No | +| [MSTEST0059](mstest0059.md) | Use Parallelize attribute correctly. | Warning | No | +| [MSTEST0060](mstest0060.md) | Duplicate TestMethodAttribute. | Warning | Yes | +| [MSTEST0061](mstest0061.md) | Use OSCondition attribute instead of runtime check. | Info | Yes | +| [MSTEST0062](mstest0062.md) | Avoid out/ref test method parameters. | Warning | Yes | \* Escalated to Error in `Recommended` and `All` modes. @@ -67,78 +67,78 @@ Usage rules support proper usage of MSTest attributes, methods, and patterns. Th Ensure your test classes, methods, and fixtures follow MSTest requirements: -- **[MSTEST0002](mstest0002.md)**: Test class layout requirements (for example, public, non-static) -- **[MSTEST0003](mstest0003.md)**: Test method layout requirements (⚠️ escalated to Error) -- **[MSTEST0030](mstest0030.md)**: Methods with [TestMethod] must be in a [TestClass] +- **[MSTEST0002](mstest0002.md)**: Test class layout requirements (for example, public, non-static). +- **[MSTEST0003](mstest0003.md)**: Test method layout requirements (⚠️ escalated to Error). +- **[MSTEST0030](mstest0030.md)**: Methods with [TestMethod] must be in a [TestClass]. ### Lifecycle methods Validate initialization and cleanup methods: -- **[MSTEST0008](mstest0008.md)**: TestInitialize validation -- **[MSTEST0009](mstest0009.md)**: TestCleanup validation -- **[MSTEST0010](mstest0010.md)**: ClassInitialize validation -- **[MSTEST0011](mstest0011.md)**: ClassCleanup validation -- **[MSTEST0012](mstest0012.md)**: AssemblyInitialize validation -- **[MSTEST0013](mstest0013.md)**: AssemblyCleanup validation -- **[MSTEST0034](mstest0034.md)**: Set ClassCleanupBehavior.EndOfClass -- **[MSTEST0050](mstest0050.md)**: Global test fixture validation +- **[MSTEST0008](mstest0008.md)**: TestInitialize validation. +- **[MSTEST0009](mstest0009.md)**: TestCleanup validation. +- **[MSTEST0010](mstest0010.md)**: ClassInitialize validation. +- **[MSTEST0011](mstest0011.md)**: ClassCleanup validation. +- **[MSTEST0012](mstest0012.md)**: AssemblyInitialize validation. +- **[MSTEST0013](mstest0013.md)**: AssemblyCleanup validation. +- **[MSTEST0034](mstest0034.md)**: Set ClassCleanupBehavior.EndOfClass. +- **[MSTEST0050](mstest0050.md)**: Global test fixture validation. ### Data-driven testing Ensure data attributes are used correctly: -- **[MSTEST0007](mstest0007.md)**: Data attributes must be on test methods -- **[MSTEST0014](mstest0014.md)**: DataRow validation -- **[MSTEST0018](mstest0018.md)**: DynamicData validation -- **[MSTEST0042](mstest0042.md)**: Detect duplicate DataRows -- **[MSTEST0052](mstest0052.md)**: Use AutoDetect for DynamicDataSourceType -- **[MSTEST0062](mstest0062.md)**: Avoid out/ref parameters +- **[MSTEST0007](mstest0007.md)**: Data attributes must be on test methods. +- **[MSTEST0014](mstest0014.md)**: DataRow validation. +- **[MSTEST0018](mstest0018.md)**: DynamicData validation. +- **[MSTEST0042](mstest0042.md)**: Detect duplicate DataRows. +- **[MSTEST0052](mstest0052.md)**: Use AutoDetect for DynamicDataSourceType. +- **[MSTEST0062](mstest0062.md)**: Avoid out/ref parameters. ### Writing better assertions Rules for correct and effective assertion usage: -- **[MSTEST0017](mstest0017.md)**: Pass expected/actual in correct order -- **[MSTEST0023](mstest0023.md)**: Don't negate conditions (use Assert.IsFalse directly) -- **[MSTEST0026](mstest0026.md)**: Avoid null-conditional operators in assertions -- **[MSTEST0032](mstest0032.md)**: Review always-true conditions -- **[MSTEST0037](mstest0037.md)**: Use the most appropriate assert method -- **[MSTEST0038](mstest0038.md)**: Don't use AreSame with value types -- **[MSTEST0039](mstest0039.md)**: Use Assert.ThrowsExactly (newer API) -- **[MSTEST0046](mstest0046.md)**: Prefer Assert over StringAssert -- **[MSTEST0051](mstest0051.md)**: Assert.Throws should test single statement -- **[MSTEST0053](mstest0053.md)**: Use string interpolation instead of format parameters -- **[MSTEST0058](mstest0058.md)**: Don't put assertions in catch blocks +- **[MSTEST0017](mstest0017.md)**: Pass expected/actual in correct order. +- **[MSTEST0023](mstest0023.md)**: Don't negate conditions (use Assert.IsFalse directly). +- **[MSTEST0026](mstest0026.md)**: Avoid null-conditional operators in assertions. +- **[MSTEST0032](mstest0032.md)**: Review always-true conditions. +- **[MSTEST0037](mstest0037.md)**: Use the most appropriate assert method. +- **[MSTEST0038](mstest0038.md)**: Don't use AreSame with value types. +- **[MSTEST0039](mstest0039.md)**: Use Assert.ThrowsExactly (newer API). +- **[MSTEST0046](mstest0046.md)**: Prefer Assert over StringAssert. +- **[MSTEST0051](mstest0051.md)**: Assert.Throws should test single statement. +- **[MSTEST0053](mstest0053.md)**: Use string interpolation instead of format parameters. +- **[MSTEST0058](mstest0058.md)**: Don't put assertions in catch blocks. ### TestContext usage Proper usage of the TestContext object: -- **[MSTEST0005](mstest0005.md)**: TestContext property validation -- **[MSTEST0024](mstest0024.md)**: Don't store TestContext in static fields -- **[MSTEST0048](mstest0048.md)**: Restricted property access in fixtures -- **[MSTEST0049](mstest0049.md)**: Flow cancellation tokens from TestContext -- **[MSTEST0054](mstest0054.md)**: Use TestContext.CancellationToken property +- **[MSTEST0005](mstest0005.md)**: TestContext property validation. +- **[MSTEST0024](mstest0024.md)**: Don't store TestContext in static fields. +- **[MSTEST0048](mstest0048.md)**: Restricted property access in fixtures. +- **[MSTEST0049](mstest0049.md)**: Flow cancellation tokens from TestContext. +- **[MSTEST0054](mstest0054.md)**: Use TestContext.CancellationToken property. ### Async patterns Rules for asynchronous test code: -- **[MSTEST0040](mstest0040.md)**: Avoid asserts in async void methods +- **[MSTEST0040](mstest0040.md)**: Avoid asserts in async void methods. ### Test configuration -- **[MSTEST0031](mstest0031.md)**: Use proper attributes (not System.ComponentModel.Description) -- **[MSTEST0035](mstest0035.md)**: DeploymentItem usage -- **[MSTEST0041](mstest0041.md)**: Condition attributes must be on test classes -- **[MSTEST0043](mstest0043.md)**: Retry attributes must be on test methods (⚠️ escalated to Error) -- **[MSTEST0055](mstest0055.md)**: Don't ignore string method return values -- **[MSTEST0056](mstest0056.md)**: Set DisplayName properly on TestMethodAttribute -- **[MSTEST0057](mstest0057.md)**: Propagate source info in custom TestMethodAttribute -- **[MSTEST0059](mstest0059.md)**: Don't use both Parallelize and DoNotParallelize -- **[MSTEST0060](mstest0060.md)**: Avoid duplicate TestMethodAttribute -- **[MSTEST0061](mstest0061.md)**: Use OSCondition attribute for platform checks +- **[MSTEST0031](mstest0031.md)**: Use proper attributes (not System.ComponentModel.Description). +- **[MSTEST0035](mstest0035.md)**: DeploymentItem usage. +- **[MSTEST0041](mstest0041.md)**: Condition attributes must be on test classes. +- **[MSTEST0043](mstest0043.md)**: Retry attributes must be on test methods (⚠️ escalated to Error). +- **[MSTEST0055](mstest0055.md)**: Don't ignore string method return values. +- **[MSTEST0056](mstest0056.md)**: Set DisplayName properly on TestMethodAttribute. +- **[MSTEST0057](mstest0057.md)**: Propagate source info in custom TestMethodAttribute. +- **[MSTEST0059](mstest0059.md)**: Don't use both Parallelize and DoNotParallelize. +- **[MSTEST0060](mstest0060.md)**: Avoid duplicate TestMethodAttribute. +- **[MSTEST0061](mstest0061.md)**: Use OSCondition attribute for platform checks. ## Related documentation