Skip to content

Commit 7f63a2e

Browse files
nohwnd-botEvangelinkCopilot
authored
Fix GlobalTestInitialize/Cleanup implementation gaps (#9662) by @Evangelink in #9670 (backport to rel/4.3) (#9675)
Co-authored-by: Amaury Levé <amauryleve@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 39f9f28 commit 7f63a2e

17 files changed

Lines changed: 21 additions & 29 deletions

‎src/Analyzers/MSTest.Analyzers/AnalyzerReleases.Unshipped.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ MSTEST0067 | Performance | Disabled | AvoidThreadSleepAndTaskWaitInTestsAnalyzer
1212
MSTEST0068 | Usage | Info | CollectionAssertToAssertAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/core/testing/mstest-analyzers/mstest0068)
1313
MSTEST0070 | Usage | Warning | MemberConditionShouldBeValidAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/core/testing/mstest-analyzers/mstest0070)
1414
MSTEST0071 | Usage | Info | RedundantTestMethodDisplayNameAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/core/testing/mstest-analyzers/mstest0071)
15+
16+
### Changed Rules
17+
18+
Rule ID | New Category | New Severity | Old Category | Old Severity | Notes
19+
--------|--------------|--------------|--------------|--------------|-------
20+
MSTEST0050 | Usage | Warning | Usage | Error | GlobalTestFixtureShouldBeValidAnalyzer

‎src/Analyzers/MSTest.Analyzers/GlobalTestFixtureShouldBeValidAnalyzer.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public sealed class GlobalTestFixtureShouldBeValidAnalyzer : DiagnosticAnalyzer
2424
new LocalizableResourceString(nameof(Resources.GlobalTestFixtureShouldBeValidMessageFormat), Resources.ResourceManager, typeof(Resources)),
2525
new LocalizableResourceString(nameof(Resources.GlobalTestFixtureShouldBeValidDescription), Resources.ResourceManager, typeof(Resources)),
2626
Category.Usage,
27-
DiagnosticSeverity.Error,
27+
DiagnosticSeverity.Warning,
2828
isEnabledByDefault: true);
2929

3030
/// <inheritdoc />

‎src/Analyzers/MSTest.Analyzers/Resources.resx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ The type declaring these methods should also respect the following rules:
784784
The type declaring these methods should also respect the following rules:
785785
-The type should be a class
786786
-The class should be 'public'
787-
-The class shouldn't be 'static'
788787
-The class should be marked with '[TestClass]' (or a derived attribute)
789788
-the class should not be generic.</value>
790789
<comment>{Locked="[GlobalTestInitialize]"}{Locked="[GlobalTestCleanup]"}{Locked="[TestClass]"}{Locked="TestContext"}{Locked="ValueTask"}{Locked="Task"}{Locked="public"}{Locked="static"}{Locked="void"}{Locked="async void"}{Locked="async"}{Locked="class"}</comment>

‎src/Analyzers/MSTest.Analyzers/xlf/Resources.cs.xlf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,9 @@ Typ deklarující tyto metody by měl také respektovat následující pravidla:
561561
The type declaring these methods should also respect the following rules:
562562
-The type should be a class
563563
-The class should be 'public'
564-
-The class shouldn't be 'static'
565564
-The class should be marked with '[TestClass]' (or a derived attribute)
566565
-the class should not be generic.</source>
567-
<target state="translated">Aby byly metody s označením [GlobalTestInitialize] nebo [GlobalTestCleanup] platné, musí se řídit následujícím rozložením:
566+
<target state="needs-review-translation">Aby byly metody s označením [GlobalTestInitialize] nebo [GlobalTestCleanup] platné, musí se řídit následujícím rozložením:
568567
– Nesmí být deklarované pro obecnou class.
569568
– Musí být „public“.
570569
– Musí být „static“.

‎src/Analyzers/MSTest.Analyzers/xlf/Resources.de.xlf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,9 @@ Der Typ, der diese Methoden deklariert, sollte auch die folgenden Regeln beachte
562562
The type declaring these methods should also respect the following rules:
563563
-The type should be a class
564564
-The class should be 'public'
565-
-The class shouldn't be 'static'
566565
-The class should be marked with '[TestClass]' (or a derived attribute)
567566
-the class should not be generic.</source>
568-
<target state="translated">Methoden, die mit „[GlobalTestInitialize]“ oder „[GlobalTestCleanup]“ gekennzeichnet sind, sollten dem folgenden Layout folgen, um gültig zu sein:
567+
<target state="needs-review-translation">Methoden, die mit „[GlobalTestInitialize]“ oder „[GlobalTestCleanup]“ gekennzeichnet sind, sollten dem folgenden Layout folgen, um gültig zu sein:
569568
– kann nicht für eine generische class deklariert werden
570569
– muss „public“ sein
571570
– muss „static“ sein

‎src/Analyzers/MSTest.Analyzers/xlf/Resources.es.xlf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,9 @@ El tipo que declara estos métodos también debe respetar las reglas siguientes:
561561
The type declaring these methods should also respect the following rules:
562562
-The type should be a class
563563
-The class should be 'public'
564-
-The class shouldn't be 'static'
565564
-The class should be marked with '[TestClass]' (or a derived attribute)
566565
-the class should not be generic.</source>
567-
<target state="translated">Los métodos marcados con '[GlobalTestInitialize]' o '[GlobalTestCleanup]' deben seguir el siguiente diseño para ser válidos:
566+
<target state="needs-review-translation">Los métodos marcados con '[GlobalTestInitialize]' o '[GlobalTestCleanup]' deben seguir el siguiente diseño para ser válidos:
568567
-no se puede declarar en una class genérica
569568
- debería ser 'public'
570569
- debería estar 'static'

‎src/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,9 @@ Le type doit être une classe
561561
The type declaring these methods should also respect the following rules:
562562
-The type should be a class
563563
-The class should be 'public'
564-
-The class shouldn't be 'static'
565564
-The class should be marked with '[TestClass]' (or a derived attribute)
566565
-the class should not be generic.</source>
567-
<target state="translated">Les méthodes marquées par « [GlobalTestInitialize] » ou « [GlobalTestCleanup] » doivent respecter le schéma suivant pour être valides :
566+
<target state="needs-review-translation">Les méthodes marquées par « [GlobalTestInitialize] » ou « [GlobalTestCleanup] » doivent respecter le schéma suivant pour être valides :
568567
- elle ne peut pas être déclarée dans une classe générique
569568
– elle doit être « public »
570569
– elle doit être « static »

‎src/Analyzers/MSTest.Analyzers/xlf/Resources.it.xlf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,9 @@ Anche il tipo che dichiara questi metodi deve rispettare le regole seguenti:
561561
The type declaring these methods should also respect the following rules:
562562
-The type should be a class
563563
-The class should be 'public'
564-
-The class shouldn't be 'static'
565564
-The class should be marked with '[TestClass]' (or a derived attribute)
566565
-the class should not be generic.</source>
567-
<target state="translated">I metodi contrassegnati con ‘[GlobalTestInitialize]’ o ‘[GlobalTestCleanup]’ devono seguire il layout seguente per essere validi:
566+
<target state="needs-review-translation">I metodi contrassegnati con ‘[GlobalTestInitialize]’ o ‘[GlobalTestCleanup]’ devono seguire il layout seguente per essere validi:
568567
- Non può essere dichiarato in una classe generica
569568
- Deve essere 'public'
570569
- Deve essere 'static'

‎src/Analyzers/MSTest.Analyzers/xlf/Resources.ja.xlf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,9 @@ The type declaring these methods should also respect the following rules:
561561
The type declaring these methods should also respect the following rules:
562562
-The type should be a class
563563
-The class should be 'public'
564-
-The class shouldn't be 'static'
565564
-The class should be marked with '[TestClass]' (or a derived attribute)
566565
-the class should not be generic.</source>
567-
<target state="translated">'[GlobalTestInitialize]' または '[GlobalTestCleanup]' でマークされたメソッドを有効にするには、次のレイアウトに従う必要があります:
566+
<target state="needs-review-translation">'[GlobalTestInitialize]' または '[GlobalTestCleanup]' でマークされたメソッドを有効にするには、次のレイアウトに従う必要があります:
568567
- ジェネリック class で宣言することはできません
569568
- 'public' である必要があります
570569
- 'static' である必要があります

‎src/Analyzers/MSTest.Analyzers/xlf/Resources.ko.xlf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,9 @@ The type declaring these methods should also respect the following rules:
561561
The type declaring these methods should also respect the following rules:
562562
-The type should be a class
563563
-The class should be 'public'
564-
-The class shouldn't be 'static'
565564
-The class should be marked with '[TestClass]' (or a derived attribute)
566565
-the class should not be generic.</source>
567-
<target state="translated">'[GlobalTestInitialize]' 또는 '[GlobalTestCleanup]'으로 표시된 메서드는 다음 레이아웃을 따라야 유효합니다.
566+
<target state="needs-review-translation">'[GlobalTestInitialize]' 또는 '[GlobalTestCleanup]'으로 표시된 메서드는 다음 레이아웃을 따라야 유효합니다.
568567
- 제네릭 class에서 선언할 수 없습니다.
569568
- 'public'이어야 합니다.
570569
- 'static'이어야 합니다.

0 commit comments

Comments
 (0)