-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix analyzer messages not localized (#4434)
- Loading branch information
1 parent
d0e61e2
commit 2564c52
Showing
4 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AnalyzersTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.Testing.Platform.Acceptance.IntegrationTests; | ||
using Microsoft.Testing.Platform.Acceptance.IntegrationTests.Helpers; | ||
|
||
namespace MSTest.Acceptance.IntegrationTests; | ||
|
||
[TestClass] | ||
public sealed class AnalyzersTests : AcceptanceTestBase<NopAssetFixture> | ||
{ | ||
[TestMethod] | ||
public async Task AnalyzerMessagesShouldBeLocalized() | ||
{ | ||
string code = """ | ||
#file Analyzers.csproj | ||
<Project Sdk="MSTest.Sdk/$MSTestVersion$"> | ||
<PropertyGroup> | ||
<TargetFrameworks>$TargetFrameworks$</TargetFrameworks> | ||
<RunAnalyzers>true</RunAnalyzers> | ||
</PropertyGroup> | ||
</Project> | ||
#file UnitTest1.cs | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
[TestClass] | ||
public class UnitTest1 | ||
{ | ||
[DataRow(0)] | ||
public void TestMethod() | ||
{ | ||
} | ||
} | ||
""".PatchTargetFrameworks(TargetFrameworks.NetCurrent) | ||
.PatchCodeWithReplace("$MSTestVersion$", MSTestVersion); | ||
|
||
using TestAsset testAsset = await TestAsset.GenerateAssetAsync("Analyzers", code); | ||
DotnetMuxerResult result = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, environmentVariables: new() | ||
{ | ||
["DOTNET_CLI_UI_LANGUAGE"] = "it-IT", | ||
["PreferredUILang"] = "it-IT", | ||
["VSLang"] = "1040", | ||
}, warnAsError: false); | ||
result.AssertOutputContains("DataRow deve essere impostato solo su un metodo di test"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters