Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Dec 19, 2024
1 parent 765cffc commit 670dc46
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ parseOptions:=Nothing,
compilationOptions:=Nothing,
options:=Nothing,
"IDE0051",
DiagnosticSeverity.Info,
DiagnosticSeverity.Hidden,
diagnosticMessage:=String.Format(AnalyzersResources.Private_member_0_is_unused, "C.New"))
End Function
End Class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QuickInfo;

[UseExportProvider]
[Trait(Traits.Feature, Traits.Features.QuickInfo)]
public class DiagnosticAnalyzerQuickInfoSourceTests
public sealed class DiagnosticAnalyzerQuickInfoSourceTests
{
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/46604")]
public async Task ErrorTitleIsShownOnDisablePragma()
Expand Down Expand Up @@ -156,26 +156,26 @@ public async Task QuickInfoSuppressMessageAttributeUseCases(string suppressMessa
? GetFormattedIDEAnalyzerTitle(51, nameof(AnalyzersResources.Remove_unused_private_members))
: null;
await TestAsync(
@$"
using System.Diagnostics.CodeAnalysis;
using SM = System.Diagnostics.CodeAnalysis.SuppressMessageAttribute;
namespace T
{{
public static class DiagnosticIds
{{
public const string IDE0051 = ""IDE0051"";
}}
$$"""
using System.Diagnostics.CodeAnalysis;
using SM = System.Diagnostics.CodeAnalysis.SuppressMessageAttribute;
namespace T
{
public static class DiagnosticIds
{
public const string IDE0051 = "IDE0051";
}
{suppressMessageAttribute}
public class C
{{
private int _i;
}}
}}
", description, ImmutableArray<TextSpan>.Empty);
{{suppressMessageAttribute}}
public class C
{
private int _i;
}
}
""", description, ImmutableArray<TextSpan>.Empty);
}

protected static async Task AssertContentIsAsync(EditorTestWorkspace workspace, Document document, int position, string expectedDescription,
private static async Task AssertContentIsAsync(EditorTestWorkspace workspace, Document document, int position, string expectedDescription,
ImmutableArray<TextSpan> relatedSpans)
{
var info = await GetQuickinfo(workspace, document, position);
Expand All @@ -194,13 +194,13 @@ private static async Task<QuickInfoItem> GetQuickinfo(EditorTestWorkspace worksp
return info;
}

protected static async Task AssertNoContentAsync(EditorTestWorkspace workspace, Document document, int position)
private static async Task AssertNoContentAsync(EditorTestWorkspace workspace, Document document, int position)
{
var info = await GetQuickinfo(workspace, document, position);
Assert.Null(info);
}

protected static async Task TestAsync(
private static async Task TestAsync(
string code,
string expectedDescription,
ImmutableArray<TextSpan> relatedSpans,
Expand Down Expand Up @@ -237,7 +237,7 @@ private static string GetFormattedIDEAnalyzerTitle(int ideDiagnosticId, string n
return $"IDE{ideDiagnosticId:0000}: {localizable}";
}

protected static Task TestInClassAsync(string code, string expectedDescription, params TextSpan[] relatedSpans)
private static Task TestInClassAsync(string code, string expectedDescription, params TextSpan[] relatedSpans)
=> TestAsync(
$$"""
class C
Expand All @@ -246,7 +246,7 @@ class C
}
""", expectedDescription, relatedSpans.ToImmutableArray());

protected static Task TestInMethodAsync(string code, string expectedDescription, params TextSpan[] relatedSpans)
private static Task TestInMethodAsync(string code, string expectedDescription, params TextSpan[] relatedSpans)
=> TestInClassAsync(
$$"""
void M()
Expand Down

0 comments on commit 670dc46

Please sign in to comment.