Skip to content

Commit 9ed994e

Browse files
TestFramework: Move framework files (#8568)
1 parent 4972c6d commit 9ed994e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+118
-147
lines changed

analyzers/tests/SonarAnalyzer.Net8.Test/SonarAnalyzer.Net8.Test.csproj

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
</ItemGroup>
2929

3030
<ItemGroup>
31-
<ProjectReference Include="..\SonarAnalyzer.Test\SonarAnalyzer.Test.csproj" />
31+
<ProjectReference Include="..\SonarAnalyzer.TestFramework\SonarAnalyzer.TestFramework.csproj" />
32+
<ProjectReference Include="..\..\src\SonarAnalyzer.CSharp\SonarAnalyzer.CSharp.csproj">
33+
<Aliases>global,csharp</Aliases>
34+
</ProjectReference>
35+
<ProjectReference Include="..\..\src\SonarAnalyzer.VisualBasic\SonarAnalyzer.VisualBasic.csproj">
36+
<Aliases>global,vbnet</Aliases>
37+
</ProjectReference>
3238
</ItemGroup>
3339

3440
</Project>

analyzers/tests/SonarAnalyzer.Test/AnalysisContext/SonarAnalysisContextTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public TestSetup(string testCase, SonarDiagnosticAnalyzer analyzer, IEnumerable<
4747
Analyzer = analyzer;
4848
additionalReferences = additionalReferences
4949
.Concat(MetadataReferenceFacade.SystemComponentModelPrimitives)
50-
.Concat(NetStandardMetadataReference.Netstandard)
50+
.Concat(MetadataReferenceFacade.NetStandard)
5151
.Concat(MetadataReferenceFacade.SystemData);
5252
Builder = new VerifierBuilder().AddAnalyzer(() => analyzer).AddPaths(Path).AddReferences(additionalReferences);
5353
}

analyzers/tests/SonarAnalyzer.Test/Common/RuleTest.cs

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using SonarAnalyzer.Rules.CSharp;
2727
using SonarAnalyzer.SymbolicExecution.Roslyn.RuleChecks.CSharp;
2828
using SonarAnalyzer.Test.Helpers;
29+
using SonarAnalyzer.Test.PackagingTests;
2930

3031
namespace SonarAnalyzer.Test.Common
3132
{
@@ -150,7 +151,7 @@ public void AllParameterizedRules_AreDisabledByDefault() =>
150151
.Where(RuleFinder.IsParameterized)
151152
.Select(type => (DiagnosticAnalyzer)Activator.CreateInstance(type))
152153
.SelectMany(analyzer => analyzer.SupportedDiagnostics)
153-
.Where(analyzer => !TestHelper.IsSecurityHotspot(analyzer))
154+
.Where(analyzer => !IsSecurityHotspot(analyzer))
154155
.ToList()
155156
.ForEach(diagnostic => diagnostic.IsEnabledByDefault.Should().BeFalse());
156157

@@ -172,7 +173,7 @@ public void AllRulesEnabledByDefault_ContainSonarWayCustomTag()
172173
var descriptors = RuleFinder.RuleAnalyzerTypes.SelectMany(SupportedDiagnostics)
173174
// Security hotspots are enabled by default, but they will report issues only
174175
// when their ID is contained in SonarLint.xml
175-
.Where(descriptor => !TestHelper.IsSecurityHotspot(descriptor));
176+
.Where(descriptor => !IsSecurityHotspot(descriptor));
176177

177178
foreach (var descriptor in descriptors)
178179
{
@@ -228,7 +229,7 @@ public void AllRules_SonarWayTagPresenceMatchesIsEnabledByDefault()
228229

229230
foreach (var diagnostic in RuleFinder.RuleAnalyzerTypes.SelectMany(SupportedDiagnostics))
230231
{
231-
if (TestHelper.IsSecurityHotspot(diagnostic))
232+
if (IsSecurityHotspot(diagnostic))
232233
{
233234
// Security hotspots are enabled by default, but they will report issues only when their ID is contained in SonarLint.xml
234235
// DiagnosticDescriptorFactory adds WellKnownDiagnosticTags.NotConfigurable to prevent rule supression and deactivation.
@@ -339,7 +340,6 @@ public void UnchangedFiles_ReportDiagnosticIfNonGeneratedBasedRule(string unchan
339340
UnchangedFiles_Verify(builder, unchangedFileName, expectEmptyResults);
340341
}
341342

342-
[AssertionMethod]
343343
private static void AllRulesAreConfigurable(AnalyzerLanguage language)
344344
{
345345
foreach (var diagnostic in SupportedDiagnostics(language))
@@ -403,6 +403,12 @@ private static void VerifyNoExceptionThrown(string path, DiagnosticAnalyzer[] di
403403
DiagnosticVerifier.VerifyNoExceptionThrown(diagnostics);
404404
}
405405

406+
private static bool IsSecurityHotspot(DiagnosticDescriptor diagnostic)
407+
{
408+
var type = RuleTypeMappingCS.Rules.GetValueOrDefault(diagnostic.Id) ?? RuleTypeMappingVB.Rules.GetValueOrDefault(diagnostic.Id);
409+
return type == "SECURITY_HOTSPOT";
410+
}
411+
406412
[DiagnosticAnalyzer(LanguageNames.CSharp)]
407413
private class ConcurrentExecutionReader : SonarDiagnosticAnalyzer
408414
{

analyzers/tests/SonarAnalyzer.Test/Common/SecurityHotspotTest.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
using SonarAnalyzer.Rules.CSharp;
22+
using SonarAnalyzer.Test.PackagingTests;
2223
using SonarAnalyzer.Test.Rules;
2324

2425
namespace SonarAnalyzer.Test.Common
@@ -65,7 +66,13 @@ private static IEnumerable<SonarDiagnosticAnalyzer> GetHotspotAnalyzers(Analyzer
6566
.Where(IsSecurityHotspot);
6667

6768
private static bool IsSecurityHotspot(DiagnosticAnalyzer analyzer) =>
68-
analyzer.SupportedDiagnostics.Any(TestHelper.IsSecurityHotspot);
69+
analyzer.SupportedDiagnostics.Any(IsSecurityHotspot);
70+
71+
private static bool IsSecurityHotspot(DiagnosticDescriptor diagnostic)
72+
{
73+
var type = RuleTypeMappingCS.Rules.GetValueOrDefault(diagnostic.Id) ?? RuleTypeMappingVB.Rules.GetValueOrDefault(diagnostic.Id);
74+
return type == "SECURITY_HOTSPOT";
75+
}
6976

7077
private static string GetTestCaseFileName(string analyzerName) =>
7178
analyzerName switch

analyzers/tests/SonarAnalyzer.Test/Helpers/AspNetMvcHelperTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void PublicFoo() { }
105105
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
106106
public void PublicNonAction() { }
107107
}";
108-
var compilation = TestHelper.CompileCS(code, NetStandardMetadataReference.Netstandard.Union(NuGetMetadataReference.MicrosoftAspNetCoreMvcCore(aspNetMvcVersion)).ToArray())
108+
var compilation = TestHelper.CompileCS(code, MetadataReferenceFacade.NetStandard.Union(NuGetMetadataReference.MicrosoftAspNetCoreMvcCore(aspNetMvcVersion)).ToArray())
109109
.Model
110110
.Compilation;
111111
var publicFoo = GetMethodSymbol(compilation, "PublicFoo");
@@ -126,7 +126,7 @@ public class Foo : Microsoft.AspNetCore.Mvc.ControllerBase
126126
{
127127
public void PublicFoo() { }
128128
}";
129-
var compilation = TestHelper.CompileCS(code, NetStandardMetadataReference.Netstandard.Union(NuGetMetadataReference.MicrosoftAspNetCoreMvcCore(aspNetMvcVersion)).ToArray())
129+
var compilation = TestHelper.CompileCS(code, MetadataReferenceFacade.NetStandard.Union(NuGetMetadataReference.MicrosoftAspNetCoreMvcCore(aspNetMvcVersion)).ToArray())
130130
.Model
131131
.Compilation;
132132
var publicFoo = GetMethodSymbol(compilation, "PublicFoo");
@@ -145,7 +145,7 @@ public class Foo : Microsoft.AspNetCore.Mvc.ControllerBase
145145
{
146146
public Foo() { }
147147
}";
148-
var (tree, semanticModel) = TestHelper.CompileCS(code, NetStandardMetadataReference.Netstandard.Union(NuGetMetadataReference.MicrosoftAspNetCoreMvcCore(aspNetMvcVersion)).ToArray());
148+
var (tree, semanticModel) = TestHelper.CompileCS(code, MetadataReferenceFacade.NetStandard.Union(NuGetMetadataReference.MicrosoftAspNetCoreMvcCore(aspNetMvcVersion)).ToArray());
149149
var methodSymbol = semanticModel.GetDeclaredSymbol(tree.Single<ConstructorDeclarationSyntax>()) as IMethodSymbol;
150150
methodSymbol.IsControllerMethod().Should().Be(false);
151151
}

analyzers/tests/SonarAnalyzer.Test/MetadataReferences/NetStandardMetadataReference.cs

-29
This file was deleted.

analyzers/tests/SonarAnalyzer.Test/PackagingTests/RuleTypeTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public void DetectRuleTypeChanges_CS() =>
3434
public void DetectRuleTypeChanges_VB() =>
3535
DetectTypeChanges(vbnet::SonarAnalyzer.RuleCatalog.Rules, RuleTypeMappingVB.Rules, LanguageNames.VisualBasic, nameof(RuleTypeMappingVB));
3636

37-
[AssertionMethod]
3837
private static void DetectTypeChanges(Dictionary<string, RuleDescriptor> rules, IImmutableDictionary<string, string> expectedTypes, string language, string expectedTypesName)
3938
{
4039
var rulesWithUnmatchingType = Enumerable.Range(1, 10000)

analyzers/tests/SonarAnalyzer.Test/Rules/AssertionArgsShouldBePassedInCorrectOrderTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void AssertionArgsShouldBePassedInCorrectOrder_NUnit_Static() =>
6767
public void AssertionArgsShouldBePassedInCorrectOrder_XUnit(string testFwkVersion) =>
6868
builder.AddPaths("AssertionArgsShouldBePassedInCorrectOrder.Xunit.cs")
6969
.AddReferences(NuGetMetadataReference.XunitFramework(testFwkVersion)
70-
.Concat(NetStandardMetadataReference.Netstandard))
70+
.Concat(MetadataReferenceFacade.NetStandard))
7171
.Verify();
7272

7373
[TestMethod]

analyzers/tests/SonarAnalyzer.Test/Rules/CertificateValidationCheckTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class CertificateValidationCheckTest
2929
private static readonly VerifierBuilder WithReferences = new VerifierBuilder()
3030
.AddReferences(MetadataReferenceFacade.SystemNetHttp)
3131
.AddReferences(MetadataReferenceFacade.SystemSecurityCryptography)
32-
.AddReferences(NetStandardMetadataReference.Netstandard);
32+
.AddReferences(MetadataReferenceFacade.NetStandard);
3333
private readonly VerifierBuilder builderCS = WithReferences.AddAnalyzer(() => new CS.CertificateValidationCheck());
3434
private readonly VerifierBuilder builderVB = WithReferences.AddAnalyzer(() => new VB.CertificateValidationCheck());
3535

analyzers/tests/SonarAnalyzer.Test/Rules/Hotspots/DeliveringDebugFeaturesInProductionTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void DeliveringDebugFeaturesInProduction_Net7_CS() =>
8383

8484
internal static IEnumerable<MetadataReference> AdditionalReferencesForAspNetCore2 =>
8585
Enumerable.Empty<MetadataReference>()
86-
.Concat(NetStandardMetadataReference.Netstandard)
86+
.Concat(MetadataReferenceFacade.NetStandard)
8787
.Concat(NuGetMetadataReference.MicrosoftAspNetCoreDiagnostics(Constants.DotNetCore220Version))
8888
.Concat(NuGetMetadataReference.MicrosoftAspNetCoreDiagnosticsEntityFrameworkCore(Constants.DotNetCore220Version))
8989
.Concat(NuGetMetadataReference.MicrosoftAspNetCoreHttpAbstractions(Constants.DotNetCore220Version))

analyzers/tests/SonarAnalyzer.Test/Rules/Hotspots/ExecutingSqlQueriesTest.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public void ExecutingSqlQueries_MonoSqlLite_Net46_VB() =>
6363
.Verify();
6464

6565
internal static IEnumerable<MetadataReference> GetReferencesNet46(string sqlServerCeVersion) =>
66-
NetStandardMetadataReference.Netstandard
67-
.Concat(FrameworkMetadataReference.SystemData)
68-
.Concat(FrameworkMetadataReference.SystemDataOracleClient)
69-
.Concat(NuGetMetadataReference.SystemDataSqlServerCe(sqlServerCeVersion))
70-
.Concat(NuGetMetadataReference.MySqlData("8.0.22"))
71-
.Concat(NuGetMetadataReference.MicrosoftDataSqliteCore())
72-
.Concat(NuGetMetadataReference.SystemDataSQLiteCore());
66+
MetadataReferenceFacade.NetStandard
67+
.Concat(FrameworkMetadataReference.SystemData)
68+
.Concat(FrameworkMetadataReference.SystemDataOracleClient)
69+
.Concat(NuGetMetadataReference.SystemDataSqlServerCe(sqlServerCeVersion))
70+
.Concat(NuGetMetadataReference.MySqlData("8.0.22"))
71+
.Concat(NuGetMetadataReference.MicrosoftDataSqliteCore())
72+
.Concat(NuGetMetadataReference.SystemDataSQLiteCore());
7373

7474
#else
7575

analyzers/tests/SonarAnalyzer.Test/Rules/SymbolicExecution/RestrictDeserializedTypesTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public class RestrictDeserializedTypesTest
5353
[TestMethod]
5454
public void RestrictDeserializedTypesFormatters_Sonar()
5555
{
56-
using var _ = new AssertIgnoreScope(); // EnsureStackState fails an assertion in this test file
5756
sonar.AddPaths("RestrictDeserializedTypes.cs")
5857
.WithOptions(ParseOptionsHelper.FromCSharp8)
5958
.Verify();

analyzers/tests/SonarAnalyzer.Test/Rules/UnusedPrivateMemberTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public void UnusedPrivateMember_Performance() =>
223223
.ExecutionTime().Should().BeLessOrEqualTo(30.Seconds());
224224

225225
private static ImmutableArray<MetadataReference> EntityFrameworkCoreReferences(string entityFrameworkVersion) =>
226-
NetStandardMetadataReference.Netstandard
226+
MetadataReferenceFacade.NetStandard
227227
.Concat(NuGetMetadataReference.MicrosoftEntityFrameworkCoreSqlServer(entityFrameworkVersion))
228228
.Concat(NuGetMetadataReference.MicrosoftEntityFrameworkCoreRelational(entityFrameworkVersion))
229229
.ToImmutableArray();

analyzers/tests/SonarAnalyzer.Test/Rules/Utilities/FileMetadataAnalyzerTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void Verify_RazorFilesAreIgnored(string fileName, params string[] expecte
121121
CreateBuilder(ProjectType.Product, fileName)
122122
.WithAdditionalFilePath(AnalysisScaffolding.CreateSonarProjectConfig(TestContext, ProjectType.Product))
123123
.VerifyUtilityAnalyzer<FileMetadataInfo>(messages =>
124-
messages.Select(x => Path.GetFileName(x.FilePath)).Should().BeEquivalentTo(expectedFiles));
124+
messages.Select(x => Path.GetFileName(x.FilePath)).Should().Contain(expectedFiles)); // There are more files on some PCs: JSExports.g.cs, LibraryImports.g.cs, JSImports.g.cs
125125

126126
#endif
127127

analyzers/tests/SonarAnalyzer.Test/SonarAnalyzer.Test.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<IsPackable>false</IsPackable>
77
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
88
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
9+
<!-- FIXME: This should be likely moved to MetadataReferences -->
910
<!--
1011
This allows, on AzureDevops builds, to restore the NuGet packages which are not targeting .Net Standard or a compatible version by
1112
usign as fallbacks .Net Framwework 4.0 client profile (net40-client) and Portable profile (portable-net45+win8+wp8+wpa81).
@@ -17,6 +18,7 @@
1718
<AssetTargetFallback>$(AssetTargetFallback);net40-client;portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
1819
</PropertyGroup>
1920

21+
<!-- FIXME: We should be able to remove this now -->
2022
<ItemGroup Condition="'$(TargetFramework)' != 'net48'">
2123
<!-- Class AspNetCoreMetadataReference needs this FrameworkReference to generate metadata references for ASP.NET Core related test cases. -->
2224
<FrameworkReference Include="Microsoft.AspNetCore.App" />
@@ -25,6 +27,7 @@
2527
</ItemGroup>
2628

2729
<ItemGroup>
30+
<!-- FIXME: Review what's still needed and what is not -->
2831
<PackageReference Include="altcover" Version="8.6.95" />
2932
<PackageReference Include="FluentAssertions" Version="6.12.0" />
3033
<PackageReference Include="FluentAssertions.Analyzers" Version="0.23.0">

analyzers/tests/SonarAnalyzer.Test/TestFramework/AnalysisScaffolding.cs analyzers/tests/SonarAnalyzer.TestFramework/Common/AnalysisScaffolding.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
namespace SonarAnalyzer.Test
2929
{
30-
internal static class AnalysisScaffolding
30+
public static class AnalysisScaffolding
3131
{
3232
public static SonarAnalysisContext CreateSonarAnalysisContext() =>
3333
new(Mock.Of<RoslynAnalysisContext>(), ImmutableArray<DiagnosticDescriptor>.Empty);

analyzers/tests/SonarAnalyzer.Test/Constants.cs analyzers/tests/SonarAnalyzer.TestFramework/Common/Constants.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace SonarAnalyzer.Test
2222
{
23-
internal static class Constants
23+
public static class Constants
2424
{
2525
public const string NuGetLatestVersion = "LATEST";
2626
public const string DotNet7Preview = "7.0.0-rc.1.22426.10";

analyzers/tests/SonarAnalyzer.Test/TestFramework/CurrentCultureScope.cs analyzers/tests/SonarAnalyzer.TestFramework/Common/CurrentCultureScope.cs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*/
2020

2121
using System.Globalization;
22-
using System.Threading;
2322

2423
namespace SonarAnalyzer.Test.Helpers
2524
{

analyzers/tests/SonarAnalyzer.Test/TestFramework/EnvironmentVariableScope.cs analyzers/tests/SonarAnalyzer.TestFramework/Common/EnvironmentVariableScope.cs

+1-11
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,9 @@ public void SetVariable(string name, string value)
5353
Environment.SetEnvironmentVariable(name, value, EnvironmentVariableTarget.Process);
5454
}
5555

56-
#region IDispose implementation
57-
5856
public void Dispose()
5957
{
60-
Dispose(true);
61-
GC.SuppressFinalize(this);
62-
}
63-
64-
private void Dispose(bool disposing)
65-
{
66-
if (disposing && originalValues != null)
58+
if (originalValues != null)
6759
{
6860
foreach (var kvp in originalValues)
6961
{
@@ -72,7 +64,5 @@ private void Dispose(bool disposing)
7264
originalValues = null;
7365
}
7466
}
75-
76-
#endregion IDispose implementation
7767
}
7868
}

analyzers/tests/SonarAnalyzer.Test/FixAllDiagnosticProvider.cs analyzers/tests/SonarAnalyzer.TestFramework/Common/FixAllDiagnosticProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
namespace SonarAnalyzer.Test
2424
{
25-
internal class FixAllDiagnosticProvider : FixAllContext.DiagnosticProvider
25+
public class FixAllDiagnosticProvider : FixAllContext.DiagnosticProvider
2626
{
2727
private readonly IEnumerable<Diagnostic> diagnostics;
2828

analyzers/tests/SonarAnalyzer.Test/TestFramework/TestHelper.cs analyzers/tests/SonarAnalyzer.TestFramework/Common/TestHelper.cs

+2-8
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
*/
2020

2121
using System.IO;
22+
using System.Security.Cryptography.Xml;
2223
using Microsoft.CodeAnalysis.CSharp.Syntax;
2324
using SonarAnalyzer.CFG;
2425
using SonarAnalyzer.CFG.Roslyn;
2526
using SonarAnalyzer.Extensions;
26-
using SonarAnalyzer.Test.PackagingTests;
2727
using StyleCop.Analyzers.Lightup;
2828
using CS = Microsoft.CodeAnalysis.CSharp;
2929
using VB = Microsoft.CodeAnalysis.VisualBasic;
3030

3131
namespace SonarAnalyzer.Test
3232
{
33-
internal static class TestHelper
33+
public static class TestHelper
3434
{
3535
public static (SyntaxTree Tree, SemanticModel Model) CompileIgnoreErrorsCS(string snippet, params MetadataReference[] additionalReferences) =>
3636
Compile(snippet, true, AnalyzerLanguage.CSharp, additionalReferences);
@@ -113,12 +113,6 @@ bool IsMethod(SyntaxNode node) =>
113113
: node.RawKind == (int)VB.SyntaxKind.FunctionBlock || node.RawKind == (int)VB.SyntaxKind.SubBlock;
114114
}
115115

116-
public static bool IsSecurityHotspot(DiagnosticDescriptor diagnostic)
117-
{
118-
var type = RuleTypeMappingCS.Rules.GetValueOrDefault(diagnostic.Id) ?? RuleTypeMappingVB.Rules.GetValueOrDefault(diagnostic.Id);
119-
return type == "SECURITY_HOTSPOT";
120-
}
121-
122116
public static IEnumerable<MetadataReference> ProjectTypeReference(ProjectType projectType) =>
123117
projectType == ProjectType.Test
124118
? NuGetMetadataReference.MSTestTestFrameworkV1 // Any reference to detect a test project

analyzers/tests/SonarAnalyzer.Test/TestFramework/ProjectBuilder.cs analyzers/tests/SonarAnalyzer.TestFramework/Compilation/ProjectBuilder.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace SonarAnalyzer.Test.TestFramework
2525
{
26-
internal readonly struct ProjectBuilder
26+
public readonly struct ProjectBuilder
2727
{
2828
private readonly Lazy<SolutionBuilder> solution;
2929
private readonly Project project;
@@ -57,7 +57,7 @@ public ProjectBuilder AddReferences(IEnumerable<MetadataReference> references)
5757
}
5858
if (references.Any(x => x.Display.Contains("\\netstandard")))
5959
{
60-
references = references.Concat(NetStandardMetadataReference.Netstandard);
60+
references = references.Concat(MetadataReferenceFacade.NetStandard);
6161
}
6262
var existingReferences = project.MetadataReferences.ToHashSet();
6363
return FromProject(project.AddMetadataReferences(references.Distinct().Where(x => !existingReferences.Contains(x))));

analyzers/tests/SonarAnalyzer.Test/TestFramework/SnippetCompiler.cs analyzers/tests/SonarAnalyzer.TestFramework/Compilation/SnippetCompiler.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828

2929
namespace SonarAnalyzer.Test.TestFramework
3030
{
31-
/// <summary>
32-
/// Helper class compiles snippets of code on the fly.
33-
/// </summary>
34-
internal class SnippetCompiler
31+
public class SnippetCompiler
3532
{
3633
public Compilation Compilation { get; }
3734
public SyntaxTree SyntaxTree { get; }

0 commit comments

Comments
 (0)