Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/Meziantou.Analyzer.Test/Helpers/ProjectBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public sealed partial class ProjectBuilder
public bool IsValidCode { get; private set; } = true;
public bool IsValidFixCode { get; private set; } = true;
public LanguageVersion LanguageVersion { get; private set; } = LanguageVersion.Latest;
public TargetFramework TargetFramework { get; private set; } = TargetFramework.NetStandard2_0;
public TargetFramework TargetFramework { get; private set; } = TargetFramework.NetLatest;
public IList<MetadataReference> References { get; } = [];
public IList<string> ApiReferences { get; } = [];
public IList<DiagnosticAnalyzer> DiagnosticAnalyzer { get; } = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public Test()
";

await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(SourceCode)
.ShouldReportDiagnosticWithMessage("Use 'Find()' instead of 'FirstOrDefault()'")
.ShouldFixCodeWith(CodeFix)
Expand Down Expand Up @@ -119,6 +120,7 @@ public Test()
";

await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(SourceCode)
.AddAnalyzerConfiguration("MA0020.report_when_conversion_needed", "true")
.ShouldReportDiagnosticWithMessage("Use 'Find()' instead of 'FirstOrDefault()'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void A()
public async Task Append_ReportDiagnostic(string text)
{
await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(@"using System.Text;
class Test
{
Expand Down Expand Up @@ -122,6 +123,7 @@ void A()
public async Task AppendLine_ReportDiagnostic(string text)
{
await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(@"using System.Text;
class Test
{
Expand Down Expand Up @@ -309,6 +311,7 @@ void A()
public async Task Append_InterpolatedString()
{
await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(@"using System.Text;
class Test
{
Expand All @@ -332,6 +335,7 @@ void A()
public async Task AppendLine_InterpolatedString_FinishWithString()
{
await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(@"using System.Text;
class Test
{
Expand All @@ -355,6 +359,7 @@ void A()
public async Task AppendLine_InterpolatedString_FinishWithChar()
{
await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(@"using System.Text;
class Test
{
Expand All @@ -378,6 +383,7 @@ void A()
public async Task AppendLine_InterpolatedString_FinishWithObject()
{
await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(@"using System.Text;
class Test
{
Expand Down Expand Up @@ -573,6 +579,7 @@ void A()
public async Task Append_StringJoin_AppendJoin_OldTargetFramework()
{
await CreateProjectBuilder()
.WithTargetFramework(TargetFramework.NetStandard2_0)
.WithSourceCode(@"using System.Text;
class Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ static async IAsyncEnumerable<int> AsyncEnumerable([EnumeratorCancellation] Canc
";

await CreateProjectBuilder()
.AddAsyncInterfaceApi()
.WithSourceCode(SourceCode)
.WithCodeFixProvider<UseAnOverloadThatHasCancellationTokenFixer_Argument>()
.ShouldFixCodeWith(Fix)
Expand Down Expand Up @@ -770,7 +769,6 @@ public static async Task A(IAsyncEnumerable<int> enumerable)
";

await CreateProjectBuilder()
.AddAsyncInterfaceApi()
.WithSourceCode(SourceCode)
.WithCodeFixProvider<UseAnOverloadThatHasCancellationTokenFixer_AwaitForEach>()
.ShouldFixCodeWith(Fix)
Expand Down Expand Up @@ -798,7 +796,6 @@ public static async Task A(IAsyncEnumerable<int> enumerable)
";

await CreateProjectBuilder()
.AddAsyncInterfaceApi()
.WithSourceCode(SourceCode)
.ValidateAsync();
}
Expand All @@ -824,7 +821,6 @@ public static async Task A(IAsyncEnumerable<int> enumerable)
";

await CreateProjectBuilder()
.AddAsyncInterfaceApi()
.WithSourceCode(SourceCode)
.ValidateAsync();
}
Expand Down Expand Up @@ -855,7 +851,6 @@ static async IAsyncEnumerable<int> AsyncEnumerable([EnumeratorCancellation] Canc
";

await CreateProjectBuilder()
.AddAsyncInterfaceApi()
.WithSourceCode(SourceCode)
.ValidateAsync();
}
Expand Down Expand Up @@ -884,7 +879,6 @@ static void A(CancellationToken cancellationToken = default)
";

await CreateProjectBuilder()
.AddAsyncInterfaceApi()
.WithSourceCode(SourceCode)
.ValidateAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ async IAsyncEnumerable<int> A(string a)
}";

await CreateProjectBuilder()
.AddAsyncInterfaceApi()
.WithSourceCode(SourceCode)
.ShouldFixCodeWith(CodeFix)
.ValidateAsync();
Expand Down