diff --git a/azure-pipelines-pr-validation.yml b/azure-pipelines-pr-validation.yml
index 12b91f142340..0afa702c1f38 100644
--- a/azure-pipelines-pr-validation.yml
+++ b/azure-pipelines-pr-validation.yml
@@ -165,28 +165,6 @@ extends:
displayName: Setting SourceBranchName variable
condition: succeeded()
- - task: Powershell@2
- name: FancyBuild
- displayName: Setting FancyBuild.BuildNumber
- inputs:
- targetType: inline
- script: |
- $pull_request = Invoke-RestMethod -Uri "https://api.github.com/repos/dotnet/roslyn/pulls/${{ parameters.PRNumber }}" `
- -Headers @{
- "Accept" = "application/vnd.github+json";
- "X-GitHub-Api-Version" = "2022-11-28"
- }
- $buildNumberName = "$(OriginalBuildNumber) - $($pull_request.user.login) - '$($pull_request.title)'"
- $buildNumberName = $buildNumberName -replace '["/:<>\|?@*]','_'
- # Maximum buildnumber length is 255 chars and we are going to append to the end to ensure we have space.
- if ($buildNumberName.Length -GT 253) {
- $buildNumberName = $buildNumberName.Substring(0, 253)
- }
- # Avoid ever ending the BuildNumber with a `.` by always appending to it.
- $buildNumberName += ' #'
- Write-Host "##vso[task.setvariable variable=BuildNumber;isoutput=true;isreadonly=true]$buildNumberName"
- Write-Host "##vso[build.updatebuildnumber]$buildNumberName"
-
- task: Powershell@2
displayName: Tag PR validation build
inputs:
@@ -204,6 +182,25 @@ extends:
arguments: "-sourceBranchName $(SourceBranchName) -prNumber ${{ parameters.PRNumber }} -commitSHA ${{ parameters.CommitSHA }} -enforceLatestCommit ${{ iif(parameters.EnforceLatestCommit, '1', '0') }}"
condition: succeeded()
+ - task: Powershell@2
+ name: FancyBuild
+ displayName: Setting FancyBuild.BuildNumber
+ inputs:
+ targetType: inline
+ script: |
+ $authorName = git log -1 --pretty=format:"%an" ${{ parameters.CommitSHA }}
+
+ $buildNumberName = "$(OriginalBuildNumber) - $($authorName) - '${{ parameters.PRNumber }}'"
+ $buildNumberName = $buildNumberName -replace '["/:<>\|?@*]','_'
+ # Maximum buildnumber length is 255 chars and we are going to append to the end to ensure we have space.
+ if ($buildNumberName.Length -GT 253) {
+ $buildNumberName = $buildNumberName.Substring(0, 253)
+ }
+ # Avoid ever ending the BuildNumber with a `.` by always appending to it.
+ $buildNumberName += ' #'
+ Write-Host "##vso[task.setvariable variable=BuildNumber;isoutput=true;isreadonly=true]$buildNumberName"
+ Write-Host "##vso[build.updatebuildnumber]$buildNumberName"
+
- powershell: Write-Host "##vso[task.setvariable variable=VisualStudio.DropName]Products/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranchName)/$(OriginalBuildNumber)"
displayName: Setting VisualStudio.DropName variable
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 494714e8fde8..509fcd0367c1 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -400,13 +400,19 @@ stages:
configuration: Release
- name: compilerChange
value: $[dependencies.Determine_Changes.outputs['SetPathVars_compilers.containsChange']]
+ # Set NUGET_PACKAGES to fix issues with package Restore when building with `-ci`.
+ # Workaround for https://github.com/dotnet/arcade/issues/15970
+ - name: NUGET_PACKAGES
+ value: $(Build.SourcesDirectory)\.packages
steps:
- template: eng/pipelines/checkout-windows-task.yml
- powershell: eng/build.ps1 -configuration Release -prepareMachine -ci -restore -binaryLogName Restore.binlog
displayName: Restore
- - powershell: eng/build.ps1 -configuration Release -prepareMachine -ci -build -pack -publish -sign -binaryLogName Build.binlog /p:DotnetPublishUsingPipelines=true /p:ContinuousIntegrationBuildCorrectness=true
+ # We additionally restore during the build because the Microsoft.DotNet.Build.Tasks.Feed package only restores when we pass `-publish`. See https://github.com/dotnet/arcade/blob/37ccfd66358af6a37a0ec385ec31d1d71bdd8723/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj#L61-L66
+ # Passing `-publish` during the restore step above fails due to no items needing published.
+ - powershell: eng/build.ps1 -configuration Release -prepareMachine -ci -restore -build -pack -publish -sign -binaryLogName Build.binlog /p:DotnetPublishUsingPipelines=true /p:ContinuousIntegrationBuildCorrectness=true
displayName: Build
# While this task is not executed in the official build, this serves as a PR check for whether symbol exclusions
diff --git a/docs/contributing/Building, Debugging, and Testing on Unix.md b/docs/contributing/Building, Debugging, and Testing on Unix.md
index 5d1d326a4d61..6f224b39f758 100644
--- a/docs/contributing/Building, Debugging, and Testing on Unix.md
+++ b/docs/contributing/Building, Debugging, and Testing on Unix.md
@@ -12,7 +12,7 @@ Particularly for developers who aren't experienced with .NET Core development on
1. Install [VS Code](https://code.visualstudio.com/Download)
- After you install VS Code, install the [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
- Important tip: You can look up editor commands by name by hitting *Ctrl+Shift+P*, or by hitting *Ctrl+P* and typing a `>` character. This will help you get familiar with editor commands mentioned below. On a Mac, use *⌘* instead of *Ctrl*.
-1. Install the [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
+1. Install the [.NET 10.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
3. You can build from VS Code by running the *Run Build Task* command, then selecting an appropriate task such as *build* or *build current project* (the latter builds the containing project for the current file you're viewing in the editor).
4. You can run tests from VS Code by opening a test class in the editor, then using the *Run Tests in Context* and *Debug Tests in Context* editor commands. You may want to bind these commands to keyboard shortcuts that match their Visual Studio equivalents (**Ctrl+R, T** for *Run Tests in Context* and **Ctrl+R, Ctrl+T** for *Debug Tests in Context*).
5. You can launch a new VS Code instance with the language server from your current code by running the "launch vscode with language server" task.
diff --git a/docs/contributing/Building, Debugging, and Testing on Windows.md b/docs/contributing/Building, Debugging, and Testing on Windows.md
index 235ae3e82854..cd3d77670b08 100644
--- a/docs/contributing/Building, Debugging, and Testing on Windows.md
+++ b/docs/contributing/Building, Debugging, and Testing on Windows.md
@@ -20,7 +20,7 @@ The minimal required version of .NET Framework is 4.7.2.
- Ensure C# and Visual Basic, MSBuild, and .NET Core are included in the selected individual components
- Ensure "Use previews of the .NET Core SDK" is checked in Tools -> Options -> Environment -> Preview Features
- Restart Visual Studio
-1. Install the [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
+1. Install the [.NET 10.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
1. [PowerShell 5.0 or newer](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell). If you are on Windows 10, you are fine; you'll only need to upgrade if you're on earlier versions of Windows. The download link is under the ["Upgrading existing Windows PowerShell"](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell) heading.
1. Run Restore.cmd
1. Open Roslyn.sln
diff --git a/docs/contributing/Compiler Test Plan.md b/docs/contributing/Compiler Test Plan.md
index c9f0f5ea2a3c..8c2303a1709d 100644
--- a/docs/contributing/Compiler Test Plan.md
+++ b/docs/contributing/Compiler Test Plan.md
@@ -55,7 +55,7 @@ This document provides guidance for thinking about language interactions and tes
- Compiler-recognized attributes should not have any effect in earlier LangVersions,
except a LangVersion error should be reported when functionality depending on the attribute is used
(for example, InlineArray conversion to Span).
-- Generics (type arguments, variance, constraints including `class`, `struct`, `new()`, `unmanaged`, `notnull`, types and interfaces with nullability)
+- Generics (type arguments, variance, constraints including `class`, `struct`, `new()`, `unmanaged`, `notnull`, `allows ref struct`, types and interfaces with nullability)
- Default and constant values
- Partial classes
- Literals
diff --git a/eng/Directory.Packages.props b/eng/Directory.Packages.props
index aa611b4cbb49..8b0c5a473de7 100644
--- a/eng/Directory.Packages.props
+++ b/eng/Directory.Packages.props
@@ -4,8 +4,8 @@
3.11.0-beta1.24081.1
8.0.0-preview.23468.1
1.1.3-beta1.24319.1
- 0.1.785-beta
- <_BasicReferenceAssembliesVersion>1.7.9
+ 0.1.796-beta
+ <_BasicReferenceAssembliesVersion>1.8.3
4.8.0-3.final
17.13.226
@@ -273,7 +273,7 @@
-
+
@@ -297,6 +297,7 @@
+
diff --git a/eng/Publishing.props b/eng/Publishing.props
index 2a0c88ef1b25..a0e65bf33255 100644
--- a/eng/Publishing.props
+++ b/eng/Publishing.props
@@ -17,11 +17,14 @@
+ Condition=" '$(PreReleaseVersionLabel)' == 'pr-validation' or '$(DotNetBuildSourceOnly)' == 'true' ">
+
<_NuGetPackagesToPush Include="@(ItemsToPushToBlobFeed)"
@@ -30,13 +33,25 @@
<_SymbolPackagesToPush Include="@(_NuGetPackagesToPush)"
Condition="$([System.String]::Copy(%(FullPath)).EndsWith('.symbols.nupkg'))" />
+ <_SymbolPackagesToPush Include="@(_NuGetPackagesToPush)"
+ Condition="$([System.String]::Copy(%(FullPath)).Contains('.Symbols.'))" />
+
+
+
+
+
+
+
+
-
+
+
+
diff --git a/eng/Version.Details.props b/eng/Version.Details.props
new file mode 100644
index 000000000000..aa1fc141196d
--- /dev/null
+++ b/eng/Version.Details.props
@@ -0,0 +1 @@
+
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index a1e403bfb422..68107c2ef0d6 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -1,15 +1,15 @@
-
+
https://github.com/dotnet/roslyn
ae1fff344d46976624e68ae17164e0607ab68b10
-
- https://github.com/dotnet/command-line-api
- e9b0511d7f1128e2bc3be7a658a2a4ea977e602d
+
+ https://github.com/dotnet/dotnet
+ c0e325f90fb79db0da6be5128dc292f2aabb264f
@@ -110,13 +110,13 @@
-
+
https://github.com/dotnet/arcade
- 80c4e4d26cb85c86f7e1be77d2d9eceeef0f3493
+ d777c20040bdc2e52b372fa98dcb84141ed692d3
-
+
https://github.com/dotnet/arcade
- 80c4e4d26cb85c86f7e1be77d2d9eceeef0f3493
+ d777c20040bdc2e52b372fa98dcb84141ed692d3
https://github.com/dotnet/symreader
@@ -126,9 +126,9 @@
https://github.com/dotnet/roslyn
5d10d428050c0d6afef30a072c4ae68776621877
-
+
https://github.com/dotnet/arcade
- 80c4e4d26cb85c86f7e1be77d2d9eceeef0f3493
+ d777c20040bdc2e52b372fa98dcb84141ed692d3
https://github.com/dotnet/roslyn-analyzers
diff --git a/eng/Versions.props b/eng/Versions.props
index a70c92287985..540580b3c22d 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -32,23 +32,23 @@
6.0.1
- 4.5.1
+ 4.6.0
4.8.6
- 4.5.5
- 4.5.0
- 6.0.0
- 4.5.4
+ 4.6.0
+ 4.6.0
+ 6.1.0
+ 4.6.0
4.5.0
- 2.0.0-beta5.25210.1
+ 2.0.0-beta7.25373.104
9.0.0
9.0.0
9.0.0
@@ -147,7 +147,7 @@
false
true
- true
+ true
-
- netstandard2.0
+ $(NetRoslyn);netstandard2.0
false
none
false
@@ -21,7 +21,9 @@
+
+
diff --git a/src/Dependencies/Threading/Microsoft.CodeAnalysis.Threading.projitems b/src/Dependencies/Threading/Microsoft.CodeAnalysis.Threading.projitems
index 1e6df1704531..a4c16e94e050 100644
--- a/src/Dependencies/Threading/Microsoft.CodeAnalysis.Threading.projitems
+++ b/src/Dependencies/Threading/Microsoft.CodeAnalysis.Threading.projitems
@@ -10,19 +10,7 @@
Microsoft.CodeAnalysis.Threading
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/RoslynParallel.NetFramework.cs b/src/Dependencies/Threading/ParallelExtensions.NetFramework.cs
similarity index 99%
rename from src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/RoslynParallel.NetFramework.cs
rename to src/Dependencies/Threading/ParallelExtensions.NetFramework.cs
index 75da6a60c1c1..23a86095528c 100644
--- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/RoslynParallel.NetFramework.cs
+++ b/src/Dependencies/Threading/ParallelExtensions.NetFramework.cs
@@ -17,17 +17,13 @@
// With only changes to make the code work on NetFx. Where changes have been made, the original code is kept around in
// an ifdef'ed block to see what it was doing.
-using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Threading;
-using Roslyn.Utilities;
-namespace Microsoft.CodeAnalysis.Shared.Utilities;
+namespace System.Threading.Tasks;
-internal static partial class RoslynParallel
+internal static partial class RoslynParallelExtensions
{
private static class NetFramework
{
diff --git a/src/Dependencies/Threading/ParallelExtensions.cs b/src/Dependencies/Threading/ParallelExtensions.cs
new file mode 100644
index 000000000000..5eec9ccdbefb
--- /dev/null
+++ b/src/Dependencies/Threading/ParallelExtensions.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#nullable enable
+
+#pragma warning disable CA1068 // CancellationToken parameters must come last
+
+using System.Collections.Generic;
+
+namespace System.Threading.Tasks;
+
+internal static partial class RoslynParallelExtensions
+{
+#if NET // binary compatibility
+ public static Task ForEachAsync(IEnumerable source, CancellationToken cancellationToken, Func body)
+ => Parallel.ForEachAsync(source, cancellationToken, body);
+
+ public static Task ForEachAsync(IEnumerable source, ParallelOptions parallelOptions, Func body)
+ => Parallel.ForEachAsync(source, parallelOptions, body);
+
+ public static Task ForEachAsync(IAsyncEnumerable source, CancellationToken cancellationToken, Func body)
+ => Parallel.ForEachAsync(source, cancellationToken, body);
+
+ public static Task ForEachAsync(IAsyncEnumerable source, ParallelOptions parallelOptions, Func body)
+ => Parallel.ForEachAsync(source, parallelOptions, body);
+#else
+ extension(Parallel)
+ {
+ public static Task ForEachAsync(IEnumerable source, CancellationToken cancellationToken, Func body)
+ => NetFramework.ForEachAsync(source, cancellationToken, body);
+
+ public static Task ForEachAsync(IEnumerable source, ParallelOptions parallelOptions, Func body)
+ => NetFramework.ForEachAsync(source, parallelOptions, body);
+
+ public static Task ForEachAsync(IAsyncEnumerable source, CancellationToken cancellationToken, Func body)
+ => NetFramework.ForEachAsync(source, cancellationToken, body);
+
+ public static Task ForEachAsync(IAsyncEnumerable source, ParallelOptions parallelOptions, Func body)
+ => NetFramework.ForEachAsync(source, parallelOptions, body);
+ }
+#endif
+}
diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ProducerConsumer.cs b/src/Dependencies/Threading/ProducerConsumer.cs
similarity index 94%
rename from src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ProducerConsumer.cs
rename to src/Dependencies/Threading/ProducerConsumer.cs
index 82eb56d9089c..6ea0da9b20c4 100644
--- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ProducerConsumer.cs
+++ b/src/Dependencies/Threading/ProducerConsumer.cs
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
+
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -9,31 +11,10 @@
using System.Threading.Channels;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.PooledObjects;
-using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Threading;
+using Roslyn.Utilities;
-namespace Microsoft.CodeAnalysis.Shared.Utilities;
-
-internal readonly record struct ProducerConsumerOptions
-{
- ///
- /// Used when the consumeItems routine will only pull items on a single thread (never concurrently). produceItems
- /// can be called concurrently on many threads.
- ///
- public static readonly ProducerConsumerOptions SingleReaderOptions = new() { SingleReader = true };
-
- ///
- /// Used when the consumeItems routine will only pull items on a single thread (never concurrently). produceItems
- /// can be called on a single thread as well (never concurrently).
- ///
- public static readonly ProducerConsumerOptions SingleReaderWriterOptions = new() { SingleReader = true, SingleWriter = true };
-
- ///
- public bool SingleWriter { get; init; }
-
- ///
- public bool SingleReader { get; init; }
-}
+namespace Microsoft.CodeAnalysis.Threading;
internal static class ProducerConsumer
{
@@ -248,7 +229,7 @@ private static Task RunParallelChannelAsync(
// We're running in parallel, so we def have multiple writers
ProducerConsumerOptions.SingleReaderOptions,
produceItems: static (callback, args, cancellationToken) =>
- RoslynParallel.ForEachAsync(
+ Parallel.ForEachAsync(
args.source,
cancellationToken,
async (source, cancellationToken) =>
@@ -310,7 +291,7 @@ public static IAsyncEnumerable RunParallelStreamAsync(
{
return RunAsync(
static (callback, args, cancellationToken) =>
- RoslynParallel.ForEachAsync(
+ Parallel.ForEachAsync(
args.source, cancellationToken,
async (source, cancellationToken) => await args.produceItems(
source, callback, args.args, cancellationToken).ConfigureAwait(false)),
diff --git a/src/Dependencies/Threading/ProducerConsumerOptions.cs b/src/Dependencies/Threading/ProducerConsumerOptions.cs
new file mode 100644
index 000000000000..99aa23ac6efe
--- /dev/null
+++ b/src/Dependencies/Threading/ProducerConsumerOptions.cs
@@ -0,0 +1,34 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#nullable enable
+
+using System.Threading.Channels;
+
+namespace Microsoft.CodeAnalysis.Threading;
+
+internal readonly record struct ProducerConsumerOptions
+{
+ ///
+ /// Used when the consumeItems routine will only pull items on a single thread (never concurrently). produceItems
+ /// can be called concurrently on many threads.
+ ///
+ public static readonly ProducerConsumerOptions SingleReaderOptions = new() { SingleReader = true };
+
+ ///
+ /// Used when the consumeItems routine will only pull items on a single thread (never concurrently). produceItems
+ /// can be called on a single thread as well (never concurrently).
+ ///
+ public static readonly ProducerConsumerOptions SingleReaderWriterOptions = new() { SingleReader = true, SingleWriter = true };
+
+#if NET
+ ///
+#endif
+ public bool SingleWriter { get; init; }
+
+#if NET
+ ///
+#endif
+ public bool SingleReader { get; init; }
+}
diff --git a/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteHelpers.cs b/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteHelpers.cs
index f2805572e35a..fdf6ae572836 100644
--- a/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteHelpers.cs
+++ b/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteHelpers.cs
@@ -7,12 +7,14 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
+using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
+using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue.VsdbgIntegration;
using Microsoft.VisualStudio.Text;
namespace Microsoft.CodeAnalysis.Editor.CSharp.StringCopyPaste;
@@ -497,19 +499,39 @@ static bool WillEscapeAnyCharacters(bool isInterpolated, string value)
string? commonIndentPrefix = null;
var first = true;
+ using var allLines = TemporaryArray.Empty;
+
foreach (var change in textChanges)
{
var text = SourceText.From(change.NewText);
foreach (var line in text.Lines)
{
- if (first)
- {
- first = false;
- continue;
- }
-
var nonWhitespaceIndex = GetFirstNonWhitespaceIndex(text, line);
- if (nonWhitespaceIndex >= 0)
+
+ // For the first line, we only want to consider its indentation if it *has* any. That's because
+ // people often copy by avoiding indentation on the first line and starting their selection on the
+ // first real construct. e.g.:
+ //
+ // [|Goo
+ // Bar
+ // Baz|]
+ //
+ // In this case, we don't want to say that there is no common indentation to trim since there is
+ // no indentation on the selection's first line. However, we do want to trim if the user selected
+ // whitespace a-la:
+ //
+ // [|Goo
+ // Bar
+ // Baz|]
+ //
+ // In this case, we really only want to trim the common whitespace of all three lines, not the whitespace
+ // of the second/third lines. If we do the latter, we'd end up with Goo and Bar being aligned, which
+ // doesn't match the original intent.
+
+ var minimumStartColumn = first ? 1 : 0;
+ first = false;
+
+ if (nonWhitespaceIndex >= minimumStartColumn)
commonIndentPrefix = GetCommonIndentationPrefix(commonIndentPrefix, text, TextSpan.FromBounds(line.Start, nonWhitespaceIndex));
}
}
@@ -554,6 +576,11 @@ public static bool RawContentMustBeMultiLine(SourceText text, ImmutableArray spans)
+ {
foreach (var span in spans)
{
for (var i = span.Start; i < span.End; i++)
diff --git a/src/EditorFeatures/CSharp/StringCopyPaste/UnknownSourcePasteProcessor.cs b/src/EditorFeatures/CSharp/StringCopyPaste/UnknownSourcePasteProcessor.cs
index 8e5611ff9494..e72ba8aeba5a 100644
--- a/src/EditorFeatures/CSharp/StringCopyPaste/UnknownSourcePasteProcessor.cs
+++ b/src/EditorFeatures/CSharp/StringCopyPaste/UnknownSourcePasteProcessor.cs
@@ -168,9 +168,15 @@ private void AdjustWhitespaceAndAddTextChangesForSingleLineRawStringLiteral(Arra
if (mustBeMultiLine)
edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace));
- SourceText? textOfCurrentChange = null;
- var commonIndentationPrefix = GetCommonIndentationPrefix(Changes) ?? "";
+ // Only if we're ending with a multi-line raw string do we want to consider the first line when determining
+ // the common indentation prefix to trim out. If we don't have a multi-line raw string, then that means we
+ // pasted a boring single-line string into a single-line raw string, and in that case, we don't want to touch
+ // the contents at all.
+ var commonIndentationPrefix = SpansContainsNewLine(TextAfterPaste, TextContentsSpansAfterPaste)
+ ? GetCommonIndentationPrefix(Changes) ?? ""
+ : "";
+ SourceText? textOfCurrentChange = null;
foreach (var change in Changes)
{
// Create a text object around the change text we're making. This is a very simple way to get
diff --git a/src/EditorFeatures/CSharpTest/AddMissingImports/CSharpAddMissingImportsRefactoringProviderTests.cs b/src/EditorFeatures/CSharpTest/AddMissingImports/CSharpAddMissingImportsRefactoringProviderTests.cs
index 93ceaedbf573..8eaa7aa5b169 100644
--- a/src/EditorFeatures/CSharpTest/AddMissingImports/CSharpAddMissingImportsRefactoringProviderTests.cs
+++ b/src/EditorFeatures/CSharpTest/AddMissingImports/CSharpAddMissingImportsRefactoringProviderTests.cs
@@ -64,7 +64,7 @@ private Task TestInRegularAndScriptAsync(
{ GenerationOptions.SeparateImportDirectiveGroups, separateImportDirectiveGroups },
{ CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, placeInsideNamespace ? InsideNamespaceOption : OutsideNamespaceOption },
};
- return TestInRegularAndScriptAsync(initialMarkup, expectedMarkup, options: options);
+ return TestInRegularAndScriptAsync(initialMarkup, expectedMarkup, new(options: options));
}
[WpfFact]
diff --git a/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLineEnderTests.cs b/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLineEnderTests.cs
index 2cc2573ac233..80410311e65a 100644
--- a/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLineEnderTests.cs
+++ b/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLineEnderTests.cs
@@ -18,44 +18,35 @@ public sealed class AutomaticLineEnderTests : AbstractAutomaticLineEnderTests
{
[WpfFact]
public void Creation()
- {
- Test("""
+ => Test("""
$$
""", "$$");
- }
[WpfFact]
public void Usings()
- {
- Test("""
+ => Test("""
using System;
$$
""", @"using System$$");
- }
[WpfFact]
public void Namespace()
- {
- Test("""
+ => Test("""
namespace {}
$$
""", @"namespace {$$}");
- }
[WpfFact]
public void Class()
- {
- Test("""
+ => Test("""
class {}
$$
""", "class {$$}");
- }
[WpfFact]
public void Method()
- {
- Test("""
+ => Test("""
class C
{
void Method() {$$}
@@ -66,12 +57,10 @@ class C
void Method() {$$}
}
""", assertNextHandlerInvoked: true);
- }
[WpfFact]
public void Field()
- {
- Test("""
+ => Test("""
class C
{
private readonly int i = 3;
@@ -83,12 +72,10 @@ class C
pri$$vate re$$adonly i$$nt i = 3$$
}
""");
- }
[WpfFact]
public void EventField()
- {
- Test("""
+ => Test("""
class C
{
event System.EventHandler e = null;
@@ -100,12 +87,10 @@ class C
e$$vent System.Even$$tHandler e$$ = null$$
}
""");
- }
[WpfFact]
public void Field2()
- {
- Test("""
+ => Test("""
class C
{
private readonly int i;
@@ -117,12 +102,10 @@ class C
private readonly int i$$
}
""");
- }
[WpfFact]
public void EventField2()
- {
- Test("""
+ => Test("""
class C
{
event System.EventHandler e
@@ -136,12 +119,10 @@ class C
eve$$nt System.E$$ventHandler e$$
}
""");
- }
[WpfFact]
public void Field3()
- {
- Test("""
+ => Test("""
class C
{
private readonly int
@@ -153,12 +134,10 @@ class C
private readonly int$$
}
""");
- }
[WpfFact]
public void EventField3()
- {
- Test("""
+ => Test("""
class C
{
event System.EventHandler
@@ -170,12 +149,10 @@ class C
event System.EventHandler$$
}
""");
- }
[WpfFact]
public void EmbeddedStatement()
- {
- Test("""
+ => Test("""
class C
{
void Method()
@@ -195,12 +172,10 @@ void Method()
}
}
""");
- }
[WpfFact]
public void EmbeddedStatement1()
- {
- Test("""
+ => Test("""
class C
{
void Method()
@@ -220,12 +195,10 @@ void Method()
}
}
""");
- }
[WpfFact]
public void EmbeddedStatement2()
- {
- Test("""
+ => Test("""
class C
{
void Method()
@@ -245,12 +218,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/57323")]
public void EmbeddedStatementFollowedByStatement()
- {
- Test("""
+ => Test("""
class C
{
void Method()
@@ -282,12 +253,10 @@ void Method()
}
}
""");
- }
[WpfFact]
public void Statement()
- {
- Test("""
+ => Test("""
class C
{
void Method()
@@ -305,12 +274,10 @@ int i$$
}
}
""");
- }
[WpfFact]
public void Statement1()
- {
- Test("""
+ => Test("""
class C
{
void Method()
@@ -328,12 +295,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedMethod()
- {
- Test("""
+ => Test("""
class T
{
int M() => 1 + 2;
@@ -345,12 +310,10 @@ class T
int M() => 1 + 2$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedOperator()
- {
- Test("""
+ => Test("""
class Complex
{
int real; int imaginary;
@@ -366,12 +329,10 @@ class Complex
private Complex Add(int b) => null;
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedConversionOperator()
- {
- Test("""
+ => Test("""
using System;
public struct DBBool
{
@@ -401,12 +362,10 @@ public struct DBBool
public static implicit operator DBBool(bool x) => x ? new DBBool(1) : dbFalse$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedProperty()
- {
- Test("""
+ => Test("""
class T
{
int P1 => 1 + 2;
@@ -418,12 +377,10 @@ class T
int P1 => 1 + 2$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedIndexer()
- {
- Test("""
+ => Test("""
using System;
class SampleCollection
{
@@ -439,12 +396,10 @@ class SampleCollection
public T this[int i] => i > 0 ? arr[i + 1] : arr[i + 2]$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedMethodWithBlockBodiedAnonymousMethodExpression()
- {
- Test("""
+ => Test("""
using System;
class TestClass
{
@@ -464,12 +419,10 @@ Func Y() => delegate (int x)
}$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedMethodWithSingleLineBlockBodiedAnonymousMethodExpression()
- {
- Test("""
+ => Test("""
using System;
class TestClass
{
@@ -483,12 +436,10 @@ class TestClass
Func Y() => delegate (int x) { return 9; }$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedMethodWithBlockBodiedSimpleLambdaExpression()
- {
- Test("""
+ => Test("""
using System;
class TestClass
{
@@ -508,12 +459,10 @@ Func Y() => f =>
}$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedMethodWithExpressionBodiedSimpleLambdaExpression()
- {
- Test("""
+ => Test("""
using System;
class TestClass
{
@@ -527,12 +476,10 @@ class TestClass
Func Y() => f => f * 9$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void ExpressionBodiedMethodWithBlockBodiedAnonymousMethodExpressionInMethodArgs()
- {
- Test("""
+ => Test("""
using System;
class TestClass
{
@@ -556,12 +503,10 @@ class TestClass
private int Method1(Func p) => null;
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void Format_SimpleExpressionBodiedMember()
- {
- Test("""
+ => Test("""
class T
{
int M() => 1 + 2;
@@ -573,12 +518,10 @@ class T
int M() => 1 + 2$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void Format_ExpressionBodiedMemberWithSingleLineBlock()
- {
- Test("""
+ => Test("""
using System;
class TestClass
{
@@ -592,12 +535,10 @@ class TestClass
Func Y () => delegate(int x) { return 9 ; }$$
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/3944")]
public void Format_ExpressionBodiedMemberWithMultiLineBlock()
- {
- Test("""
+ => Test("""
using System;
class TestClass
{
@@ -617,12 +558,10 @@ Func Y() => delegate(int x)
}$$
}
""");
- }
[WpfFact]
public void Format_Statement()
- {
- Test("""
+ => Test("""
class C
{
void Method()
@@ -640,21 +579,17 @@ void Method()
}
}
""");
- }
[WpfFact]
public void Format_Using()
- {
- Test("""
+ => Test("""
using System.Linq;
$$
""", @" using System . Linq $$");
- }
[WpfFact]
public void Format_Using2()
- {
- Test("""
+ => Test("""
using
System.Linq;
$$
@@ -662,12 +597,10 @@ public void Format_Using2()
using
System . Linq $$
""");
- }
[WpfFact]
public void Format_Field()
- {
- Test("""
+ => Test("""
class C
{
int i = 1;
@@ -679,12 +612,10 @@ class C
int i = 1 $$
}
""");
- }
[WpfFact]
public void Statement_Trivia()
- {
- Test("""
+ => Test("""
class C
{
void goo()
@@ -702,12 +633,10 @@ void goo()
}
}
""");
- }
[WpfFact]
public void TrailingText_Negative()
- {
- Test("""
+ => Test("""
class C
{
event System.EventHandler e = null int i = 2;
@@ -719,12 +648,10 @@ class C
event System.EventHandler e = null$$ int i = 2;
}
""");
- }
[WpfFact]
public void CompletionSetUp()
- {
- Test("""
+ => Test("""
class Program
{
object goo(object o)
@@ -742,12 +669,10 @@ object goo(object o)
}
}
""", completionActive: true);
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530352")]
public void EmbeddedStatement3()
- {
- Test("""
+ => Test("""
class Program
{
void Method()
@@ -767,12 +692,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/66102")]
public void EmbeddedStatement4()
- {
- Test("""
+ => Test("""
class Program
{
void Method()
@@ -792,12 +715,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530716")]
public void DoNotAssertOnMultilineToken()
- {
- Test(""""
+ => Test(""""
interface I
{
void M(string s = @"""
@@ -809,12 +730,10 @@ interface I
void M(string s = @"""$$
}
"""");
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530718")]
public void AutomaticLineFormat()
- {
- Test("""
+ => Test("""
class C
{
public string P { set; get; }
@@ -826,12 +745,10 @@ class C
public string P {set;get;$$}
}
""");
- }
[WpfFact]
public void NotAfterExisitingSemicolon()
- {
- Test("""
+ => Test("""
class TestClass
{
private int i;
@@ -843,12 +760,10 @@ class TestClass
private int i;$$
}
""");
- }
[WpfFact]
public void NotAfterCloseBraceInMethod()
- {
- Test("""
+ => Test("""
class TestClass
{
void Test() { }
@@ -860,12 +775,10 @@ class TestClass
void Test() { }$$
}
""");
- }
[WpfFact]
public void NotAfterCloseBraceInStatement()
- {
- Test("""
+ => Test("""
class TestClass
{
void Test()
@@ -883,12 +796,10 @@ void Test()
}
}
""");
- }
[WpfFact]
public void NotAfterAutoPropertyAccessor()
- {
- Test("""
+ => Test("""
class TestClass
{
public int A { get; set }
@@ -900,12 +811,10 @@ class TestClass
public int A { get; set$$ }
}
""");
- }
[WpfFact]
public void NotAfterAutoPropertyDeclaration()
- {
- Test("""
+ => Test("""
class TestClass
{
public int A { get; set; }
@@ -917,12 +826,10 @@ class TestClass
public int A { get; set; }$$
}
""");
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150480")]
public void DelegatedInEmptyBlock()
- {
- Test("""
+ => Test("""
class TestClass
{
void Method()
@@ -939,12 +846,10 @@ void Method()
}
}
""", assertNextHandlerInvoked: true);
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150480")]
public void DelegatedInEmptyBlock2()
- {
- Test("""
+ => Test("""
class TestClass
{
void Method()
@@ -961,12 +866,10 @@ void Method()
}
}
""", assertNextHandlerInvoked: true);
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150480")]
public void NotDelegatedOutsideEmptyBlock()
- {
- Test("""
+ => Test("""
class TestClass
{
void Method()
@@ -984,12 +887,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150480")]
public void NotDelegatedAfterOpenBraceAndMissingCloseBrace()
- {
- Test("""
+ => Test("""
class TestClass
{
void Method()
@@ -1007,12 +908,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150480")]
public void NotDelegatedInNonEmptyBlock()
- {
- Test("""
+ => Test("""
class TestClass
{
void Method()
@@ -1030,12 +929,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150480")]
public void NotDelegatedAfterOpenBraceInAnonymousObjectCreationExpression()
- {
- Test("""
+ => Test("""
class TestClass
{
void Method()
@@ -1053,12 +950,10 @@ void Method()
}
}
""");
- }
[WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150480")]
public void NotDelegatedAfterOpenBraceObjectCreationExpression()
- {
- Test("""
+ => Test("""
class TestClass
{
void Method()
@@ -1076,12 +971,10 @@ void Method()
}
}
""");
- }
[WpfFact]
public void TestMultipleNamespace()
- {
- Test($$"""
+ => Test($$"""
namespace Bar2
{
$$
@@ -1095,7 +988,6 @@ namespace Bar
{
}
""");
- }
[WpfTheory]
[InlineData("namespace")]
@@ -1105,8 +997,7 @@ namespace Bar
[InlineData("enum")]
[InlineData("interface")]
public void TestEmptyBaseTypeDeclarationAndNamespace(string typeKeyword)
- {
- Test($$"""
+ => Test($$"""
public {{typeKeyword}} Bar
{
$$
@@ -1114,7 +1005,6 @@ public void TestEmptyBaseTypeDeclarationAndNamespace(string typeKeyword)
""", $"""
pu$$blic {typeKeyword} $$Bar$$
""");
- }
[WpfTheory]
[InlineData("class")]
@@ -1123,8 +1013,7 @@ public void TestEmptyBaseTypeDeclarationAndNamespace(string typeKeyword)
[InlineData("enum")]
[InlineData("interface")]
public void TestMultipleBaseTypeDeclaration(string typeKeyword)
- {
- Test($$"""
+ => Test($$"""
public {{typeKeyword}} Bar2
{
$$
@@ -1139,12 +1028,10 @@ public void TestMultipleBaseTypeDeclaration(string typeKeyword)
{
}
""");
- }
[WpfFact]
public void TestNestedTypeDeclaration()
- {
- Test("""
+ => Test("""
public class Bar1
{
public class Bar2
@@ -1159,12 +1046,10 @@ public class Bar1
pu$$blic cla$$ss B$$ar2$$
}
""");
- }
[WpfFact]
public void TestNestedNamespace()
- {
- Test("""
+ => Test("""
namespace Bar1
{
namespace Bar2
@@ -1179,7 +1064,6 @@ namespace Bar1
namespa$$ce $$B$$ar2$$
}
""");
- }
[WpfTheory]
[InlineData("namespace")]
@@ -1189,14 +1073,12 @@ namespace Bar1
[InlineData("enum")]
[InlineData("interface")]
public void TestBaseTypeDeclarationAndNamespaceWithOpenBrace(string typeKeyword)
- {
- Test($$"""
+ => Test($$"""
public {{typeKeyword}} Bar {
$$
""", $$"""
pub$$lic {{typeKeyword}} B$$ar {$$
""");
- }
[WpfTheory]
[InlineData("namespace")]
@@ -1206,18 +1088,15 @@ public void TestBaseTypeDeclarationAndNamespaceWithOpenBrace(string typeKeyword)
[InlineData("enum")]
[InlineData("interface")]
public void TestValidTypeDeclarationAndNamespace(string typeKeyword)
- {
- Test($$"""
+ => Test($$"""
public {{typeKeyword}} Bar {}
$$
""",
$@"public {typeKeyword}$$ Ba$$r {{}}$$");
- }
[WpfFact]
public void TestMethod()
- {
- Test("""
+ => Test("""
public class Bar
{
void Main()
@@ -1231,12 +1110,10 @@ public class Bar
v$$oid Ma$$in($$)$$
}
""");
- }
[WpfFact]
public void TestConstructor()
- {
- Test("""
+ => Test("""
public class Bar
{
void Bar()
@@ -1250,12 +1127,10 @@ public class Bar
v$$oid Ba$$r($$)$$
}
""");
- }
[WpfFact]
public void TestValidMethodInInterface()
- {
- Test("""
+ => Test("""
public interface Bar
{
void Main();
@@ -1267,12 +1142,10 @@ public interface Bar
v$$oid Mai$$n($$)$$;
}
""");
- }
[WpfFact]
public void TestMissingSemicolonMethodInInterface()
- {
- Test("""
+ => Test("""
public interface Bar
{
void Main()
@@ -1284,12 +1157,10 @@ public interface Bar
v$$oid Mai$$n($$)$$
}
""");
- }
[WpfFact]
public void TestValidLocalFunction()
- {
- Test("""
+ => Test("""
public class Bar
{
void Main()
@@ -1311,12 +1182,10 @@ void Main()
}
}
""");
- }
[WpfFact]
public void TestLocalFunction()
- {
- Test("""
+ => Test("""
public class Bar
{
void Main()
@@ -1336,12 +1205,10 @@ void Main()
}
}
""");
- }
[WpfFact]
public void TestIndexerAsLastElementInClass()
- {
- Test("""
+ => Test("""
public class Bar
{
public int this[int i]
@@ -1355,12 +1222,10 @@ public class Bar
p$$ublic in$$t thi$$s[in$$t i]$$
}
""");
- }
[WpfFact]
public void TestIndexerNotAsLastElementInClass()
- {
- Test("""
+ => Test("""
public class Bar
{
public int this[int i]
@@ -1376,12 +1241,10 @@ public class Bar
void Main() {}
}
""");
- }
[WpfFact]
public void TestValidIndexer()
- {
- Test("""
+ => Test("""
public class Bar
{
public int this[int i]
@@ -1397,7 +1260,6 @@ public class Bar
}
}
""");
- }
[WpfFact]
public void TestGetAccessorOfProperty()
@@ -1473,8 +1335,7 @@ public int P
[WpfFact]
public void TestGetAccessorOfIndexer()
- {
- Test("""
+ => Test("""
public class Bar
{
public int this[int i]
@@ -1494,12 +1355,10 @@ public int this[int i]
}
}
""");
- }
[WpfFact]
public void TestValidGetAccessorOfIndexer()
- {
- Test("""
+ => Test("""
public class Bar
{
public int this[int i]
@@ -1523,12 +1382,10 @@ public int this[int i]
}
}
""");
- }
[WpfFact]
public void TestNonEmptyGetAccessor()
- {
- Test("""
+ => Test("""
public Class Bar
{
public int P
@@ -1559,12 +1416,10 @@ public int P
}
}
""");
- }
[WpfFact]
public void TestNonEmptySetAccessor()
- {
- Test("""
+ => Test("""
public Class Bar
{
public int P
@@ -1595,12 +1450,10 @@ public int P
}
}
""");
- }
[WpfFact]
public void TestSetAccessorOfIndexer()
- {
- Test("""
+ => Test("""
public class Bar
{
public int this[int i]
@@ -1622,12 +1475,10 @@ public int this[int i]
}
}
""");
- }
[WpfFact]
public void TestValidSetAccessorOfIndexer()
- {
- Test("""
+ => Test("""
public class Bar
{
public int this[int i]
@@ -1653,12 +1504,10 @@ public int this[int i]
}
}
""");
- }
[WpfFact]
public void TestAddAccessorInEventDeclaration()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -1682,12 +1531,10 @@ public event EventHandler e
}
}
""");
- }
[WpfFact]
public void TestValidAddAccessorInEventDeclaration()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -1715,12 +1562,10 @@ public event EventHandler e
}
}
""");
- }
[WpfFact]
public void TestRemoveAccessor()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -1744,12 +1589,10 @@ public event EventHandler e
}
}
""");
- }
[WpfFact]
public void TestValidRemoveAccessor()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -1777,7 +1620,6 @@ public event EventHandler e
}
}
""");
- }
[WpfFact]
public void TestField()
@@ -1808,8 +1650,7 @@ public class Bar
[WpfFact]
public void TestReadonlyField()
- {
- Test("""
+ => Test("""
public class Bar
{
public readonly int iii;
@@ -1821,12 +1662,10 @@ public class Bar
p$$ublic reado$$nly i$$nt i$$ii$$
}
""");
- }
[WpfFact]
public void TestNonEmptyProperty()
- {
- Test("""
+ => Test("""
public class Bar
{
public int Foo
@@ -1844,12 +1683,10 @@ public int Foo
}
}
""");
- }
[WpfFact]
public void TestMultipleFields()
- {
- Test("""
+ => Test("""
public class Bar
{
public int apple, banana;
@@ -1861,12 +1698,10 @@ public class Bar
p$$ublic i$$nt ap$$ple$$, ba$$nana;$$
}
""");
- }
[WpfFact]
public void TestMultipleEvents()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -1880,7 +1715,6 @@ public class Bar
p$$ublic event EventHandler ap$$ple$$, ba$$nana$$;$$
}
""");
- }
[WpfFact]
public void TestEvent()
@@ -1914,8 +1748,7 @@ public class Bar
[WpfFact]
public void TestNonEmptyEvent()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -1935,7 +1768,6 @@ public event EventHandler Foo
}
}
""");
- }
[WpfFact]
public void TestObjectCreationExpressionWithParenthesis()
@@ -2206,8 +2038,7 @@ public class Foo
[WpfFact]
public void TestObjectCreationExpressionWithNonEmptyInitializer()
- {
- Test(
+ => Test(
"""
public class Bar
{
@@ -2238,12 +2069,9 @@ public class Foo
}
""");
- }
-
[WpfFact]
public void TestArrayInitializer1()
- {
- Test(
+ => Test(
"""
using System.Collections.Generic;
public class Bar
@@ -2265,12 +2093,10 @@ public void M()
}
}
""");
- }
[WpfFact]
public void TestArrayInitializer2()
- {
- Test(
+ => Test(
"""
using System.Collections.Generic;
public class Bar
@@ -2292,12 +2118,10 @@ public void M()
}
}
""");
- }
[WpfFact]
public void TestCollectionInitializerWithNonEmptyInitializer()
- {
- Test(
+ => Test(
"""
using System.Collections.Generic;
public class Bar
@@ -2319,12 +2143,10 @@ public void M()
}
}
""");
- }
[WpfFact]
public void TestCollectionExpression()
- {
- Test(
+ => Test(
"""
using System.Collections.Generic;
public class Bar
@@ -2346,12 +2168,10 @@ public void M()
}
}
""");
- }
[WpfFact]
public void TestIfStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main(bool x)
@@ -2373,12 +2193,10 @@ public void Main(bool x)
}
}
""");
- }
[WpfFact]
public void TestIfStatementWithFollowingElseClause()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main(bool x)
@@ -2402,12 +2220,10 @@ public void Main(bool x)
}
}
""");
- }
[WpfFact]
public void TestIfStatementWithoutStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main(bool x)
@@ -2427,12 +2243,10 @@ public void Main(bool x)
}
}
""");
- }
[WpfFact]
public void TestNestIfStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main(int x)
@@ -2460,12 +2274,10 @@ public void Main(int x)
}
}
""");
- }
[WpfFact]
public void TestNestIfStatementWithoutInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main(int x)
@@ -2491,12 +2303,10 @@ public void Main(int x)
}
}
""");
- }
[WpfFact]
public void TestNestedElseIfStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo(int i)
@@ -2532,12 +2342,10 @@ public void Fo(int i)
}
}
""");
- }
[WpfFact]
public void TestNestIfElseStatementWithBlockWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main(int x)
@@ -2575,12 +2383,10 @@ public void Main(int x)
}
}
""");
- }
[WpfFact]
public void TestEmptyDoStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main()
@@ -2600,12 +2406,10 @@ public void Main()
}
}
""");
- }
[WpfFact]
public void TestDoStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main()
@@ -2627,12 +2431,10 @@ public void Main()
}
}
""");
- }
[WpfFact]
public void TestDoStatementWithWhileClause()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Main()
@@ -2656,12 +2458,10 @@ public void Main()
}
}
""");
- }
[WpfFact]
public void TestSingleElseStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -2687,12 +2487,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestElseStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -2720,12 +2518,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestElseIfStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -2751,12 +2547,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestElseIfInTheMiddleWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -2790,12 +2584,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestElseClauseInNestedIfStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo(int i)
@@ -2827,12 +2619,10 @@ public void Fo(int i)
}
}
""");
- }
[WpfFact]
public void TestForStatementWithoutStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -2852,12 +2642,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestForStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -2879,12 +2667,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestForEachStatementWithoutInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -2906,12 +2692,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestLockStatementWithoutInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
object o = new object();
@@ -2933,12 +2717,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestLockStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
object o = new object();
@@ -2962,12 +2744,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestUsingStatementWithoutInnerStatement()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -2999,12 +2779,10 @@ public void Dispose()
{}
}
""");
- }
[WpfFact]
public void TestUsingStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -3038,12 +2816,10 @@ public void Dispose()
{}
}
""");
- }
[WpfFact]
public void TestUsingInLocalDeclarationStatement()
- {
- Test("""
+ => Test("""
using System;
public class Bar
{
@@ -3073,12 +2849,10 @@ public void Dispose()
{}
}
""");
- }
[WpfFact]
public void TestWhileStatementWithoutInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -3098,12 +2872,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestWhileStatementWithInnerStatement()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Fo()
@@ -3125,12 +2897,10 @@ public void Fo()
}
}
""");
- }
[WpfFact]
public void TestSwitchExpression1()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Goo(int c)
@@ -3152,12 +2922,9 @@ public void Goo(int c)
}
""");
- }
-
[WpfFact]
public void TestSwitchExpression2()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Goo(int c)
@@ -3179,8 +2946,6 @@ public void Goo(int c)
}
""");
- }
-
[WpfFact]
public void TestSwitchStatementWithOnlyOpenParenthesis()
{
@@ -3211,8 +2976,7 @@ public void TT()
[WpfFact]
public void TestSwitchStatement()
- {
- Test("""
+ => Test("""
public class bar
{
public void TT()
@@ -3234,12 +2998,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestValidSwitchStatement()
- {
- Test("""
+ => Test("""
public class bar
{
public void TT()
@@ -3263,12 +3025,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestValidTryStatement()
- {
- Test("""
+ => Test("""
public class bar
{
public void TT()
@@ -3290,12 +3050,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestTryStatement()
- {
- Test("""
+ => Test("""
public class bar
{
public void TT()
@@ -3315,12 +3073,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestValidCatchClause()
- {
- Test("""
+ => Test("""
public class Bar
{
public void TT()
@@ -3348,12 +3104,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestCatchClauseWithException()
- {
- Test("""
+ => Test("""
public class Bar
{
public void TT()
@@ -3379,12 +3133,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestSingleCatchClause()
- {
- Test("""
+ => Test("""
public class bar
{
public void TT()
@@ -3410,12 +3162,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestCatchClauseWithWhenClause()
- {
- Test("""
+ => Test("""
public class bar
{
public void TT()
@@ -3441,12 +3191,10 @@ public void TT()
}
}
""");
- }
[WpfFact]
public void TestFinallyClause()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Bar2()
@@ -3478,12 +3226,10 @@ public void Bar2()
}
}
""");
- }
[WpfFact]
public void TestValidFinallyClause()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Bar2()
@@ -3517,12 +3263,10 @@ public void Bar2()
}
}
""");
- }
[WpfFact]
public void TestObjectCreationExpressionWithMissingType()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Bar2()
@@ -3543,12 +3287,10 @@ public void Bar2()
}
}
""");
- }
[WpfFact]
public void TestRemoveInitializerForImplicitObjectCreationExpression()
- {
- Test("""
+ => Test("""
public class Bar
{
public void Bar2()
@@ -3570,14 +3312,12 @@ public void Bar2()
}
}
""");
- }
[WpfTheory]
[InlineData("checked")]
[InlineData("unchecked")]
public void TestCheckedStatement(string keywordToken)
- {
- Test($$"""
+ => Test($$"""
public class Bar
{
public void Bar2()
@@ -3598,14 +3338,12 @@ public void Bar2()
}
}
""");
- }
[WpfTheory]
[InlineData("checked")]
[InlineData("unchecked")]
public void TextCheckedExpression(string keywordToken)
- {
- Test($$"""
+ => Test($$"""
public class Bar
{
public void Bar2()
@@ -3624,12 +3362,10 @@ public void Bar2()
}
}
""");
- }
[WpfFact]
public void TestConvertFieldToPropertyWithAttributeAndComment()
- {
- Test("""
+ => Test("""
public class Bar
{
public int Property
@@ -3654,12 +3390,10 @@ public int Property$$
public void Method() { }
}
""");
- }
[WpfFact]
public void TestConvertEventFieldToPropertyWithAttributeAndComment()
- {
- Test("""
+ => Test("""
public class Bar
{
public event EventHandler MyEvent
@@ -3684,7 +3418,6 @@ public event EventHandler MyEvent$$
public void Method() { }
}
""");
- }
protected override string Language => LanguageNames.CSharp;
diff --git a/src/EditorFeatures/CSharpTest/BlockCommentEditing/BlockCommentEditingTests.cs b/src/EditorFeatures/CSharpTest/BlockCommentEditing/BlockCommentEditingTests.cs
index eb7ea406f9f9..cb0121ff3490 100644
--- a/src/EditorFeatures/CSharpTest/BlockCommentEditing/BlockCommentEditingTests.cs
+++ b/src/EditorFeatures/CSharpTest/BlockCommentEditing/BlockCommentEditingTests.cs
@@ -21,112 +21,91 @@ public sealed class BlockCommentEditingTests : AbstractTypingCommandHandlerTest<
{
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/11057")]
public void EdgeCase0()
- {
- Verify(@"
+ => Verify(@"
$$/**/
", @"
$$/**/
");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/11057")]
public void EdgeCase1()
- {
- Verify(@"
+ => Verify(@"
/**/$$
", @"
/**/
$$
");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/11056")]
public void EdgeCase2()
- {
- Verify(@"
+ => Verify(@"
$$/* */
", @"
$$/* */
");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/11056")]
public void EdgeCase3()
- {
- Verify(@"
+ => Verify(@"
/* */$$
", @"
/* */
$$
");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/16128")]
public void EofCase0()
- {
- Verify(@"
+ => Verify(@"
/* */$$", @"
/* */
$$");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/16128")]
public void EofCase1()
- {
- Verify(@"
+ => Verify(@"
/*$$", @"
/*
* $$");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/16128")]
public void EofCase2()
- {
- Verify(@"
+ => Verify(@"
/***$$", @"
/***
* $$");
- }
[WpfFact]
public void InsertOnStartLine0()
- {
- Verify(@"
+ => Verify(@"
/*$$
", @"
/*
* $$
");
- }
[WpfFact]
public void InsertOnStartLine1()
- {
- Verify(@"
+ => Verify(@"
/*$$*/
", @"
/*
$$*/
");
- }
[WpfFact]
public void InsertOnStartLine2()
- {
- Verify(@"
+ => Verify(@"
/*$$ */
", @"
/*
* $$*/
");
- }
[WpfFact]
public void InsertOnStartLine3()
- {
- Verify(@"
+ => Verify(@"
/* $$ 1.
*/
", @"
@@ -134,12 +113,10 @@ public void InsertOnStartLine3()
* $$1.
*/
");
- }
[WpfFact]
public void InsertOnStartLine4()
- {
- Verify(@"
+ => Verify(@"
/* 1.$$
*/
", @"
@@ -147,45 +124,37 @@ public void InsertOnStartLine4()
* $$
*/
");
- }
[WpfFact]
public void InsertOnStartLine5()
- {
- Verify(@"
+ => Verify(@"
/********$$
", @"
/********
* $$
");
- }
[WpfFact]
public void InsertOnStartLine6()
- {
- Verify(@"
+ => Verify(@"
/**$$
", @"
/**
* $$
");
- }
[WpfFact]
public void InsertOnStartLine7()
- {
- Verify(@"
+ => Verify(@"
/* $$
", @"
/*
* $$
");
- }
[WpfFact]
public void NotInsertOnStartLine0()
- {
- Verify(@"
+ => Verify(@"
/$$*
*/
", @"
@@ -193,12 +162,10 @@ public void NotInsertOnStartLine0()
$$*
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine0()
- {
- Verify(@"
+ => Verify(@"
/*
*$$
", @"
@@ -206,12 +173,10 @@ public void InsertOnMiddleLine0()
*
*$$
");
- }
[WpfFact]
public void InsertOnMiddleLine1()
- {
- Verify(@"
+ => Verify(@"
/*
*$$*/
", @"
@@ -219,12 +184,10 @@ public void InsertOnMiddleLine1()
*
$$*/
");
- }
[WpfFact]
public void InsertOnMiddleLine2()
- {
- Verify(@"
+ => Verify(@"
/*
*$$ */
", @"
@@ -232,12 +195,10 @@ public void InsertOnMiddleLine2()
*
*$$*/
");
- }
[WpfFact]
public void InsertOnMiddleLine3()
- {
- Verify(@"
+ => Verify(@"
/*
* $$ 1.
*/
@@ -247,12 +208,10 @@ public void InsertOnMiddleLine3()
* $$1.
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine4()
- {
- Verify(@"
+ => Verify(@"
/*
* 1.$$
*/
@@ -262,12 +221,10 @@ public void InsertOnMiddleLine4()
* $$
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine5()
- {
- Verify(@"
+ => Verify(@"
/*
* 1.
* $$
@@ -279,12 +236,10 @@ public void InsertOnMiddleLine5()
* $$
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine6()
- {
- Verify(@"
+ => Verify(@"
/*
$$ *
*/
@@ -294,12 +249,10 @@ public void InsertOnMiddleLine6()
$$*
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine7()
- {
- Verify(@"
+ => Verify(@"
/*
*************$$
*/
@@ -309,12 +262,10 @@ public void InsertOnMiddleLine7()
*$$
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine8()
- {
- Verify(@"
+ => Verify(@"
/**
*$$
*/
@@ -324,12 +275,10 @@ public void InsertOnMiddleLine8()
*$$
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine9()
- {
- Verify(@"
+ => Verify(@"
/**
*$$
", @"
@@ -337,12 +286,10 @@ public void InsertOnMiddleLine9()
*
*$$
");
- }
[WpfFact]
public void InsertOnEndLine0()
- {
- Verify(@"
+ => Verify(@"
/*
*$$/
", @"
@@ -350,12 +297,10 @@ public void InsertOnEndLine0()
*
*$$/
");
- }
[WpfFact]
public void InsertOnEndLine1()
- {
- Verify(@"
+ => Verify(@"
/**
*$$/
", @"
@@ -363,12 +308,10 @@ public void InsertOnEndLine1()
*
*$$/
");
- }
[WpfFact]
public void InsertOnEndLine2()
- {
- Verify(@"
+ => Verify(@"
/**
*
*$$/
@@ -378,12 +321,10 @@ public void InsertOnEndLine2()
*
*$$/
");
- }
[WpfFact]
public void InsertOnEndLine3()
- {
- Verify(@"
+ => Verify(@"
/*
$$ */
", @"
@@ -391,12 +332,10 @@ public void InsertOnEndLine3()
$$*/
");
- }
[WpfFact]
public void InsertOnEndLine4()
- {
- Verify(@"
+ => Verify(@"
/*
$$*/
", @"
@@ -404,12 +343,10 @@ public void InsertOnEndLine4()
$$*/
");
- }
[WpfFact]
public void NotInsertInVerbatimString0()
- {
- Verify(@"
+ => Verify(@"
var code = @""
/*$$
"";
@@ -419,12 +356,10 @@ public void NotInsertInVerbatimString0()
$$
"";
");
- }
[WpfFact]
public void NotInsertInVerbatimString1()
- {
- Verify(@"
+ => Verify(@"
var code = @""
/*
*$$
@@ -436,63 +371,51 @@ public void NotInsertInVerbatimString1()
$$
"";
");
- }
[WpfFact]
public void BoundCheckInsertOnStartLine0()
- {
- Verify(@"
+ => Verify(@"
/$$*", @"
/
$$*");
- }
[WpfFact]
public void BoundCheckInsertOnStartLine1()
- {
- Verify(@"
+ => Verify(@"
/*$$ ", @"
/*
* $$");
- }
[WpfFact]
public void BoundCheckInsertOnMiddleLine()
- {
- Verify(@"
+ => Verify(@"
/*
*$$ ", @"
/*
*
*$$");
- }
[WpfFact]
public void BoundCheckInsertOnEndLine()
- {
- Verify(@"
+ => Verify(@"
/*
*$$/", @"
/*
*
*$$/");
- }
[WpfFact]
public void InsertOnStartLine2_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/*$$*/
", @"
/*
* $$*/
");
- }
[WpfFact]
public void InsertOnStartLine3_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/*$$1.
*/
", @"
@@ -500,12 +423,10 @@ public void InsertOnStartLine3_Tab()
*$$1.
*/
");
- }
[WpfFact]
public void InsertOnStartLine4_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/* 1.$$
*/
", @"
@@ -513,23 +434,19 @@ public void InsertOnStartLine4_Tab()
* $$
*/
");
- }
[WpfFact]
public void InsertOnStartLine6_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/*$$
", @"
/*
*$$
");
- }
[WpfFact]
public void InsertOnMiddleLine2_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/*
*$$*/
", @"
@@ -537,12 +454,10 @@ public void InsertOnMiddleLine2_Tab()
*
*$$*/
");
- }
[WpfFact]
public void InsertOnMiddleLine3_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/*
* $$1.
*/
@@ -552,12 +467,10 @@ public void InsertOnMiddleLine3_Tab()
* $$1.
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine4_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/*
* 1.$$
*/
@@ -567,12 +480,10 @@ public void InsertOnMiddleLine4_Tab()
* $$
*/
");
- }
[WpfFact]
public void InsertOnMiddleLine5_Tab()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
/*
* 1.
* $$
@@ -584,12 +495,10 @@ public void InsertOnMiddleLine5_Tab()
* $$
*/
");
- }
[WpfFact]
public void InLanguageConstructTrailingTrivia()
- {
- Verify(@"
+ => Verify(@"
class C
{
int i; /*$$
@@ -601,12 +510,10 @@ class C
* $$
}
");
- }
[WpfFact]
public void InLanguageConstructTrailingTrivia_Tabs()
- {
- VerifyTabs(@"
+ => VerifyTabs(@"
class C
{
int i; /*$$
@@ -618,7 +525,6 @@ class C
* $$
}
");
- }
protected override EditorTestWorkspace CreateTestWorkspace(string initialMarkup)
=> EditorTestWorkspace.CreateCSharp(initialMarkup);
diff --git a/src/EditorFeatures/CSharpTest/BlockCommentEditing/CloseBlockCommentTests.cs b/src/EditorFeatures/CSharpTest/BlockCommentEditing/CloseBlockCommentTests.cs
index 562945aaaefd..92fcd6a93bb4 100644
--- a/src/EditorFeatures/CSharpTest/BlockCommentEditing/CloseBlockCommentTests.cs
+++ b/src/EditorFeatures/CSharpTest/BlockCommentEditing/CloseBlockCommentTests.cs
@@ -22,8 +22,7 @@ public sealed class CloseBlockCommentTests : AbstractTypingCommandHandlerTest Verify("""
/*
*
*$$
@@ -32,12 +31,10 @@ public void ClosedRegularlyAfterAsterisk()
*
*/$$
""");
- }
[WpfFact]
public void ClosedAfterAsteriskSpace1()
- {
- Verify("""
+ => Verify("""
/*
*
* $$
@@ -46,44 +43,36 @@ public void ClosedAfterAsteriskSpace1()
*
*/$$
""");
- }
[WpfFact]
public void ClosedAfterAsteriskSpace2()
- {
- Verify("""
+ => Verify("""
/*
* $$
""", """
/*
*/$$
""");
- }
[WpfFact]
public void NotClosedAfterSlashAsteriskSpace()
- {
- Verify("""
+ => Verify("""
/* $$
""", """
/* /$$
""");
- }
[WpfFact]
public void NotClosedAfterSlashDoubleAsteriskSpace()
- {
- Verify("""
+ => Verify("""
/** $$
""", """
/** /$$
""");
- }
[WpfFact]
public void NotClosedAfterSpaceWithoutAsterisk()
- {
- Verify("""
+ => Verify("""
/*
*
$$
@@ -92,12 +81,10 @@ public void NotClosedAfterSpaceWithoutAsterisk()
*
/$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithNonWhitespaceBeforeAsterisk1()
- {
- Verify("""
+ => Verify("""
/*
*
** $$
@@ -106,12 +93,10 @@ public void NotClosedAfterAsteriskSpaceWithNonWhitespaceBeforeAsterisk1()
*
** /$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithNonWhitespaceBeforeAsterisk2()
- {
- Verify("""
+ => Verify("""
/*
*
/* $$
@@ -120,12 +105,10 @@ public void NotClosedAfterAsteriskSpaceWithNonWhitespaceBeforeAsterisk2()
*
/* /$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithNonWhitespaceBeforeAsterisk3()
- {
- Verify("""
+ => Verify("""
/*
*
a * $$
@@ -134,12 +117,10 @@ public void NotClosedAfterAsteriskSpaceWithNonWhitespaceBeforeAsterisk3()
*
a * /$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithNonWhitespaceAfterCursor1()
- {
- Verify("""
+ => Verify("""
/*
*
* $$/
@@ -148,12 +129,10 @@ public void NotClosedAfterAsteriskSpaceWithNonWhitespaceAfterCursor1()
*
* /$$/
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithNonWhitespaceAfterCursor2()
- {
- Verify("""
+ => Verify("""
/*
*
* $$*
@@ -162,12 +141,10 @@ public void NotClosedAfterAsteriskSpaceWithNonWhitespaceAfterCursor2()
*
* /$$*
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithNonWhitespaceAfterCursor3()
- {
- Verify("""
+ => Verify("""
/*
*
* $$ a
@@ -176,12 +153,10 @@ public void NotClosedAfterAsteriskSpaceWithNonWhitespaceAfterCursor3()
*
* /$$ a
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithWhitespaceAfterCursor()
- {
- Verify("""
+ => Verify("""
/*
*
* $$
@@ -190,12 +165,10 @@ public void NotClosedAfterAsteriskSpaceWithWhitespaceAfterCursor()
*
* /$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskDoubleSpace()
- {
- Verify("""
+ => Verify("""
/*
*
* $$
@@ -204,12 +177,10 @@ public void NotClosedAfterAsteriskDoubleSpace()
*
* /$$
""");
- }
[WpfFact]
public void ClosedAfterAsteriskSpaceWithNothingBeforeAsterisk()
- {
- Verify("""
+ => Verify("""
/*
*
* $$
@@ -218,12 +189,10 @@ public void ClosedAfterAsteriskSpaceWithNothingBeforeAsterisk()
*
*/$$
""");
- }
[WpfFact]
public void ClosedAfterAsteriskSpaceWithTabsBeforeAsterisk()
- {
- VerifyTabs("""
+ => VerifyTabs("""
/*
*
* $$
@@ -232,12 +201,10 @@ public void ClosedAfterAsteriskSpaceWithTabsBeforeAsterisk()
*
*/$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceWithOptionOff()
- {
- Verify("""
+ => Verify("""
/*
*
* $$
@@ -250,12 +217,10 @@ public void NotClosedAfterAsteriskSpaceWithOptionOff()
var globalOptions = workspace.GetService();
globalOptions.SetGlobalOption(BlockCommentEditingOptionsStorage.AutoInsertBlockCommentStartString, LanguageNames.CSharp, false);
});
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceOutsideComment()
- {
- Verify("""
+ => Verify("""
/ *
*
* $$
@@ -264,12 +229,10 @@ public void NotClosedAfterAsteriskSpaceOutsideComment()
*
* /$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceInsideString()
- {
- Verify("""
+ => Verify("""
class C
{
string s = @"
@@ -284,37 +247,28 @@ class C
*
* /$$
""");
- }
[WpfFact]
public void ClosedAfterAsteriskSpaceEndOfFile()
- {
- Verify("""
+ => Verify("""
/*
* $$
""", """
/*
*/$$
""");
- }
[WpfFact]
public void NotClosedAfterAsteriskSpaceStartOfFile()
- {
- Verify(@"* $$", @"* /$$");
- }
+ => Verify(@"* $$", @"* /$$");
[WpfFact]
public void NotClosedAfterSpaceStartOfFile()
- {
- Verify(@" $$", @" /$$");
- }
+ => Verify(@" $$", @" /$$");
[WpfFact]
public void NotClosedAtStartOfFile()
- {
- Verify(@"$$", @"/$$");
- }
+ => Verify(@"$$", @"/$$");
protected override EditorTestWorkspace CreateTestWorkspace(string initialMarkup)
=> EditorTestWorkspace.CreateCSharp(initialMarkup);
diff --git a/src/EditorFeatures/CSharpTest/Classification/SyntacticClassifierTests_Preprocessor.cs b/src/EditorFeatures/CSharpTest/Classification/SyntacticClassifierTests_Preprocessor.cs
index 55337dc95879..7c8279ecb752 100644
--- a/src/EditorFeatures/CSharpTest/Classification/SyntacticClassifierTests_Preprocessor.cs
+++ b/src/EditorFeatures/CSharpTest/Classification/SyntacticClassifierTests_Preprocessor.cs
@@ -1087,7 +1087,7 @@ public Task ShortDiscardInAssignment(TestHost testHost)
=> TestInMethodAsync(
code: @"_ = 1;",
testHost: testHost,
-expected: Classifications(Identifier("_"), Operators.Equals, Number("1"), Punctuation.Semicolon));
+ expected: Classifications(Identifier("_"), Operators.Equals, Number("1"), Punctuation.Semicolon));
[Theory, CombinatorialData]
public Task UnderscoreInLambda(TestHost testHost)
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AbstractAddUsingTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AbstractAddUsingTests.cs
index d6cb4ae26b9c..5b8234ed6af2 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AbstractAddUsingTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AbstractAddUsingTests.cs
@@ -31,7 +31,7 @@ internal Task TestAsync(
int index = 0,
CodeActionPriority? priority = null,
OptionsCollection? options = null)
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
initialMarkup,
expectedMarkup,
index,
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingNuGetTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingNuGetTests.cs
index 3fce72eccca9..eef6fe5e746b 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingNuGetTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingNuGetTests.cs
@@ -62,7 +62,7 @@ public async Task TestSearchPackageCustomFeedName()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(
PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")));
@@ -81,7 +81,7 @@ class C
{
NuGetType n;
}
- """, fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object));
+ """, new TestParameters(fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object)));
}
[Fact]
@@ -99,7 +99,7 @@ public async Task TestSearchPackageFakeNugetFeed()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(
"nuget.org", new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")));
@@ -118,7 +118,7 @@ class C
{
NuGetType n;
}
- """, fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object));
+ """, new TestParameters(fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object)));
}
[Fact]
@@ -134,7 +134,7 @@ public async Task TestSearchPackageSingleName()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(
PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")));
@@ -153,7 +153,7 @@ class C
{
NuGetType n;
}
- """, fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object));
+ """, new TestParameters(fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object)));
}
[Fact]
@@ -169,7 +169,7 @@ public async Task TestSearchPackageMultipleNames()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(
PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NS1", "NS2")));
@@ -188,7 +188,7 @@ class C
{
NuGetType n;
}
- """, fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object));
+ """, new TestParameters(fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object)));
}
[Fact]
@@ -202,7 +202,7 @@ public async Task TestMissingIfPackageAlreadyInstalled()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(
PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NS1", "NS2")));
@@ -230,7 +230,7 @@ public async Task TestOptionsOffered()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(
PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NS1", "NS2")));
@@ -280,7 +280,7 @@ public async Task TestInstallGetsCalledNoVersion()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(
PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")));
@@ -299,7 +299,7 @@ class C
{
NuGetType n;
}
- """, fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object));
+ """, new TestParameters(fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object)));
installerServiceMock.Verify();
}
@@ -318,7 +318,7 @@ public async Task TestInstallGetsCalledWithVersion()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")));
@@ -336,7 +336,7 @@ class C
{
NuGetType n;
}
- """, fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object));
+ """, new TestParameters(fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object)));
installerServiceMock.Verify();
}
@@ -355,7 +355,7 @@ public async Task TestFailedInstallRollsBackFile()
var packageServiceMock = new Mock(MockBehavior.Strict);
packageServiceMock.Setup(s => s.FindReferenceAssembliesAsync(new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
- .Returns(() => ValueTaskFactory.FromResult(ImmutableArray.Empty));
+ .Returns(() => ValueTask.FromResult(ImmutableArray.Empty));
packageServiceMock.Setup(s => s.FindPackagesAsync(PackageSourceHelper.NugetOrgSourceName, new TypeQuery("NuGetType", 0), It.IsAny(), It.IsAny()))
.Returns(() => CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")));
@@ -371,7 +371,7 @@ class C
{
NuGetType n;
}
- """, fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object));
+ """, new TestParameters(fixProviderData: new FixProviderData(installerServiceMock.Object, packageServiceMock.Object)));
installerServiceMock.Verify();
}
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs
index a9f79963b3c5..72e24acbe728 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs
@@ -158,7 +158,7 @@ IDictionary Method()
}
}
""",
-testHost, index: 1);
+ testHost, index: 1);
[Theory, CombinatorialData]
public Task TestGenericWithNoArgs(TestHost testHost)
@@ -383,7 +383,7 @@ class Class
}
}
""",
-count: 1);
+ count: 1);
[Theory, CombinatorialData]
public Task TestExistingUsing(TestHost testHost)
@@ -479,7 +479,7 @@ public static void Where(this Class c)
}
}
""",
-parseOptions: Options.Regular);
+ new TestParameters(parseOptions: Options.Regular));
[Theory, CombinatorialData]
public Task TestOnEnum(TestHost testHost)
@@ -1434,7 +1434,7 @@ public static void Bar()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleSystemSortedUsings2(TestHost testHost)
@@ -1486,7 +1486,7 @@ public static void Bar()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleSystemSortedUsings3(TestHost testHost)
@@ -1516,7 +1516,7 @@ void Method()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleSystemUnsortedUsings1(TestHost testHost)
@@ -1568,7 +1568,7 @@ public static void Bar()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleSystemUnsortedUsings2(TestHost testHost)
@@ -1620,7 +1620,7 @@ public static void Bar()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleSystemUnsortedUsings3(TestHost testHost)
@@ -1650,7 +1650,7 @@ void Method()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleBogusSystemUsings1(TestHost testHost)
@@ -1678,7 +1678,7 @@ void Method()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleBogusSystemUsings2(TestHost testHost)
@@ -1706,7 +1706,7 @@ void Method()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestUsingsWithComments(TestHost testHost)
@@ -1734,7 +1734,7 @@ void Method()
}
}
""",
-testHost);
+ testHost);
// System Not on top cases
[Theory, CombinatorialData]
@@ -1787,7 +1787,7 @@ public static void Bar()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleSystemSortedUsings5(TestHost testHost)
@@ -1837,7 +1837,7 @@ public static void Bar()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
public Task TestSimpleSystemSortedUsings4(TestHost testHost)
@@ -1867,7 +1867,7 @@ void Method()
}
}
""",
-testHost, options: Option(GenerationOptions.PlaceSystemNamespaceFirst, false));
+ testHost, options: Option(GenerationOptions.PlaceSystemNamespaceFirst, false));
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538136")]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538763")]
@@ -1925,7 +1925,7 @@ public Task BugFix5950()
WriteLine(Expression.Constant(123));
""",
-parseOptions: GetScriptOptions());
+new TestParameters(parseOptions: GetScriptOptions()));
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540339")]
@@ -2166,8 +2166,8 @@ await TestAsync(
Expression
""",
-GetScriptOptions(),
-TestOptions.ReleaseDll.WithMetadataReferenceResolver(resolver));
+ new TestParameters(GetScriptOptions(),
+ TestOptions.ReleaseDll.WithMetadataReferenceResolver(resolver)));
}
[Theory, CombinatorialData]
@@ -2399,7 +2399,7 @@ static void Main(string[] args)
Log }
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/858085")]
@@ -2516,9 +2516,8 @@ [ class Class
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/875899")]
- public async Task TestAddUsingsWithExternAlias(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsWithExternAlias(TestHost testHost)
+ => TestAsync("""
namespace ProjectLib
@@ -2542,9 +2541,7 @@ static void Main(string[] args)
}
- """;
-
- const string ExpectedDocumentText = """
+ """, """
extern alias P;
using P::ProjectLib;
@@ -2559,15 +2556,12 @@ static void Main(string[] args)
}
}
}
- """;
- await TestAsync(InitialWorkspace, ExpectedDocumentText, testHost);
- }
+ """, testHost);
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/875899")]
- public async Task TestAddUsingsWithPreExistingExternAlias(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsWithPreExistingExternAlias(TestHost testHost)
+ => TestAsync("""
namespace ProjectLib
@@ -2601,9 +2595,7 @@ static void Main(string[] args)
}
- """;
-
- const string ExpectedDocumentText = """
+ """, """
extern alias P;
using P::AnotherNS;
@@ -2619,15 +2611,12 @@ static void Main(string[] args)
}
}
}
- """;
- await TestAsync(InitialWorkspace, ExpectedDocumentText, testHost);
- }
+ """, testHost);
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/875899")]
- public async Task TestAddUsingsWithPreExistingExternAlias_FileScopedNamespace(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsWithPreExistingExternAlias_FileScopedNamespace(TestHost testHost)
+ => TestAsync("""
namespace ProjectLib;
@@ -2660,9 +2649,7 @@ static void Main(string[] args)
}
- """;
-
- const string ExpectedDocumentText = """
+ """, """
extern alias P;
using P::AnotherNS;
@@ -2677,15 +2664,12 @@ static void Main(string[] args)
var x = new [|AnotherClass()|];
}
}
- """;
- await TestAsync(InitialWorkspace, ExpectedDocumentText, testHost);
- }
+ """, testHost);
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/875899")]
- public async Task TestAddUsingsNoExtern(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsNoExtern(TestHost testHost)
+ => TestAsync("""
namespace AnotherNS
@@ -2710,9 +2694,7 @@ static void Main(string[] args)
}
- """;
-
- const string ExpectedDocumentText = """
+ """, """
extern alias P;
using P::AnotherNS;
@@ -2726,15 +2708,12 @@ static void Main(string[] args)
}
}
}
- """;
- await TestAsync(InitialWorkspace, ExpectedDocumentText, testHost);
- }
+ """, testHost);
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/875899")]
- public async Task TestAddUsingsNoExtern_FileScopedNamespace(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsNoExtern_FileScopedNamespace(TestHost testHost)
+ => TestAsync("""
namespace AnotherNS;
@@ -2757,9 +2736,7 @@ static void Main(string[] args)
}
- """;
-
- const string ExpectedDocumentText = """
+ """, """
extern alias P;
using P::AnotherNS;
@@ -2772,9 +2749,7 @@ static void Main(string[] args)
var x = new AnotherClass();
}
}
- """;
- await TestAsync(InitialWorkspace, ExpectedDocumentText, testHost);
- }
+ """, testHost);
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/875899")]
@@ -2818,7 +2793,7 @@ interface MyNotifyPropertyChanged { }
/// This is just like , but this one is mine.
///
interface MyNotifyPropertyChanged { }
- """, parseOptions: options);
+ """, new TestParameters(parseOptions: options));
}
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/916368")]
@@ -2838,7 +2813,7 @@ interface MyNotifyPropertyChanged { }
/// This is just like , but this one is mine.
///
interface MyNotifyPropertyChanged { }
- """, parseOptions: options);
+ """, new TestParameters(parseOptions: options));
}
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/916368")]
@@ -2884,7 +2859,7 @@ public static explicit operator N1.D (MyClass f)
public class MyClass2
{
}
- """, parseOptions: options);
+ """, new TestParameters(parseOptions: options));
}
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/916368")]
@@ -2920,7 +2895,7 @@ public void Test(N1.D i)
{
}
}
- """, parseOptions: options);
+ """, new TestParameters(parseOptions: options));
}
[Theory, CombinatorialData]
@@ -3514,9 +3489,8 @@ class Program { static void Main ( string [ ] args ) { var a = File . OpenRead (
""", testHost);
[Fact]
- public async Task TestInaccessibleExtensionMethod()
- {
- const string initial = """
+ public Task TestInaccessibleExtensionMethod()
+ => TestMissingInRegularAndScriptAsync("""
namespace N1
{
public static class C
@@ -3538,9 +3512,7 @@ static void Main(string[] args)
}
}
}
- """;
- await TestMissingInRegularAndScriptAsync(initial);
- }
+ """);
[Theory, CombinatorialData]
[WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1116011")]
@@ -4963,7 +4935,7 @@ public static void Bar()
}
}
""",
-testHost);
+ testHost);
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/19796")]
@@ -6296,9 +6268,8 @@ static void Main(string[] args)
[Theory, CombinatorialData]
[WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1266354")]
- public async Task TestAddUsingsEditorBrowsableNeverSameProject(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsEditorBrowsableNeverSameProject(TestHost testHost)
+ => TestAsync("""
using System.ComponentModel;
@@ -6318,9 +6289,7 @@ static void Main(string[] args)
}
- """;
-
- const string ExpectedDocumentText = """
+ """, """
using ProjectLib;
class Program
@@ -6330,16 +6299,12 @@ static void Main(string[] args)
Project p = new [|Project()|];
}
}
- """;
-
- await TestAsync(InitialWorkspace, ExpectedDocumentText, testHost);
- }
+ """, testHost);
[Theory, CombinatorialData]
[WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1266354")]
- public async Task TestAddUsingsEditorBrowsableNeverDifferentProject(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsEditorBrowsableNeverDifferentProject(TestHost testHost)
+ => TestMissingAsync("""
@@ -6364,15 +6329,12 @@ static void Main(string[] args)
- """;
- await TestMissingAsync(InitialWorkspace, new TestParameters(testHost: testHost));
- }
+ """, new TestParameters(testHost: testHost));
[Theory, CombinatorialData]
[WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1266354")]
- public async Task TestAddUsingsEditorBrowsableAdvancedDifferentProjectOptionOn(TestHost testHost)
- {
- const string InitialWorkspace = """
+ public Task TestAddUsingsEditorBrowsableAdvancedDifferentProjectOptionOn(TestHost testHost)
+ => TestAsync("""
imports System.ComponentModel
@@ -6393,9 +6355,7 @@ static void Main(string[] args)
}
- """;
-
- const string ExpectedDocumentText = """
+ """, """
using ProjectLib;
class Program
@@ -6405,9 +6365,7 @@ static void Main(string[] args)
Project p = new [|Project()|];
}
}
- """;
- await TestAsync(InitialWorkspace, ExpectedDocumentText, testHost);
- }
+ """, testHost);
[Theory, CombinatorialData]
[WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1266354")]
@@ -6448,7 +6406,7 @@ static void Main(string[] args)
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/62976")]
public Task TestAddUsingPreservesNewlines1(TestHost testHost, [CombinatorialValues("\n", "\r\n")] string sourceNewLine, [CombinatorialValues("\n", "\r\n")] string configuredNewLine)
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
namespace ANamespace
{
@@ -6489,7 +6447,7 @@ class Class
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/62976")]
public Task TestAddUsingPreservesNewlines2(TestHost testHost, [CombinatorialValues("\n", "\r\n")] string sourceNewLine, [CombinatorialValues("\n", "\r\n")] string configuredNewLine)
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using BNamespace;
@@ -6541,7 +6499,7 @@ class Class
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/62976")]
public Task TestAddUsingPreservesNewlines3(TestHost testHost, [CombinatorialValues("\n", "\r\n")] string sourceNewLine, [CombinatorialValues("\n", "\r\n")] string configuredNewLine)
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using ANamespace;
@@ -6593,7 +6551,7 @@ class Class
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/24642")]
public Task TestAddUsingWithMalformedGeneric(TestHost testHost)
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class Class
{
@@ -6613,7 +6571,7 @@ class Class
[Theory, CombinatorialData]
public Task TestOutsideOfMethodWithMalformedGenericParameters(TestHost testHost)
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -6646,4 +6604,41 @@ public Task TestAssemblyLevelAttribute(TestHost testHost)
[assembly: NeutralResourcesLanguage("en")]
""", testHost);
+
+ [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/79462")]
+ public Task TestAddUsingsWithSourceGeneratedFile(TestHost testHost)
+ => TestAsync("""
+
+
+ using Goo;
+
+ Something a;
+ [|PInvoke|].GetMessage();
+
+ namespace Goo
+ {
+ class Something { }
+ }
+
+ namespace Win32
+ {
+ public class PInvoke
+ {
+ }
+ }
+
+
+
+ """, """
+ using Goo;
+ using Win32;
+
+ Something a;
+ PInvoke.GetMessage();
+
+ namespace Goo
+ {
+ class Something { }
+ }
+ """, testHost);
}
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs
index 859fa77e0e08..d44a411c348c 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTestsWithAddImportDiagnosticProvider.cs
@@ -18,13 +18,9 @@
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing;
[Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)]
-public sealed partial class AddUsingTestsWithAddImportDiagnosticProvider : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
+public sealed partial class AddUsingTestsWithAddImportDiagnosticProvider(ITestOutputHelper logger)
+ : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest(logger)
{
- public AddUsingTestsWithAddImportDiagnosticProvider(ITestOutputHelper logger)
- : base(logger)
- {
- }
-
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpUnboundIdentifiersDiagnosticAnalyzer(), new CSharpAddImportCodeFixProvider());
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests_ExtensionMethods.cs b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests_ExtensionMethods.cs
index 2c27f2d9e0ef..49ebd1d6c6ef 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests_ExtensionMethods.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests_ExtensionMethods.cs
@@ -395,7 +395,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod2()
@@ -447,7 +447,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod3()
@@ -499,7 +499,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod4()
@@ -551,7 +551,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod5()
@@ -603,7 +603,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod6()
@@ -655,7 +655,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod7()
@@ -707,7 +707,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod8()
@@ -759,7 +759,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod9()
@@ -811,7 +811,7 @@ public static void Add(this X x, int i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod10()
@@ -883,7 +883,7 @@ public static void Add(this X x, object[] i)
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/269")]
public Task TestAddUsingForAddExtensionMethod11()
@@ -955,8 +955,7 @@ public static void Add(this X x, object[] i)
}
}
""",
-index: 1,
-parseOptions: null);
+ new TestParameters(index: 1, parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/3818")]
public Task InExtensionMethodUnderConditionalAccessExpression()
@@ -1113,7 +1112,7 @@ public static void Deconstruct(this Program p, out int x, out int y) { }
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/16547")]
@@ -1388,7 +1387,7 @@ public static class FooExtensions
}
}
""",
-parseOptions: null);
+ new TestParameters(parseOptions: null));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/55117")]
public Task TestMethodConflictWithGenericExtension()
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs
index d42de6fa6e5d..d895d7cd27e5 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeTests.cs
@@ -1371,8 +1371,7 @@ internal class C : A
{
}
""",
- index: 1,
- parseOptions: null);
+ new(index: 1, parseOptions: null));
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538069")]
public Task GenerateTypeFromArrayCreation2()
@@ -1399,8 +1398,7 @@ internal class C : A
{
}
""",
- index: 1,
- parseOptions: null);
+ new(index: 1, parseOptions: null));
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538069")]
public Task GenerateTypeFromArrayCreation3()
@@ -1427,8 +1425,7 @@ internal class C
{
}
""",
- index: 1,
- parseOptions: null);
+ new(index: 1, parseOptions: null));
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539329")]
public async Task NegativeTestNotInUsingDirective()
@@ -1787,8 +1784,7 @@ public T(out DateTime d)
}
}
""",
- index: 1,
- parseOptions: TestOptions.Regular7);
+ new TestParameters(index: 1, parseOptions: TestOptions.Regular7));
[Fact]
public Task GenerateWithOutParameters2()
@@ -1951,8 +1947,7 @@ public T(out X d)
}
}
""",
- index: 2,
- parseOptions: TestOptions.Regular7);
+ new TestParameters(index: 2, parseOptions: TestOptions.Regular7));
[Fact]
public Task GenerateWithOutParameters6()
@@ -2945,8 +2940,7 @@ class Base
protected int I;
}
""",
- index: 1,
- options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error));
+ new TestParameters(index: 1, options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error)));
[Fact]
public Task GenerateWithCallToField8()
@@ -3117,7 +3111,7 @@ public D(int i)
}
}
""",
- index: 1, options: options.FieldNamesAreCamelCaseWithUnderscorePrefix);
+ new TestParameters(index: 1, options: options.FieldNamesAreCamelCaseWithUnderscorePrefix));
}
[Fact]
@@ -3243,8 +3237,7 @@ class Base
public int I { get; protected set; }
}
""",
- index: 1,
- options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error));
+ new TestParameters(index: 1, options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error)));
[Fact]
public Task GenerateWithCallToProperty3()
@@ -3327,7 +3320,7 @@ class Base
}
""",
index: 1,
- options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error));
+ new TestParameters(options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error)));
[Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/942568")]
public Task GenerateTypeWithPreferIntrinsicPredefinedKeywordFalse()
@@ -3359,7 +3352,7 @@ public T(System.Int32 i)
}
""",
index: 1,
- options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Error));
+ new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Error)));
#endregion
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs
index 0112fd0ef97d..abe543cea0cb 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/GenerateType/GenerateTypeWithUnboundAnalyzerTests.cs
@@ -51,5 +51,5 @@ internal class Goo
{
}
""",
-index: 1);
+ index: 1);
}
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromParameterTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromParameterTests.cs
index 88c95de68112..ad2dab6115af 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromParameterTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromParameterTests.cs
@@ -25,7 +25,7 @@ protected override CodeRefactoringProvider CreateCodeRefactoringProvider(EditorT
[Fact]
public Task TestInitializeFieldWithSameName()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -50,7 +50,7 @@ public C(string s)
[Fact]
public Task TestEndOfParameter1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -75,7 +75,7 @@ public C(string s)
[Fact]
public Task TestEndOfParameter2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -100,7 +100,7 @@ public C(string s, string t)
[Fact]
public Task TestInitializeFieldWithUnderscoreName()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -125,7 +125,7 @@ public C(string s)
[Fact]
public Task TestInitializeWritableProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -177,7 +177,7 @@ public C(string s)
[Fact]
public Task TestInitializeNonWritableProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -230,7 +230,7 @@ public C(string s)
[Fact]
public Task TestInitializeFieldWithWrongType1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -257,7 +257,7 @@ public C(string s)
[Fact]
public Task TestInitializeFieldWithWrongType2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -340,7 +340,7 @@ public C([||]string s)
[Fact]
public Task TestWhenAlreadyInitialized3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -370,7 +370,7 @@ public C([||]string s)
[Fact]
public Task TestInsertionLocation1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -399,7 +399,7 @@ public C(string s, string t)
[Fact]
public Task TestInsertionLocation2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -428,7 +428,7 @@ public C(string s, string t)
[Fact]
public Task TestInsertionLocation3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -470,7 +470,7 @@ public void M([||]string s)
[Fact]
public Task TestInsertionLocation4()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -497,7 +497,7 @@ public C(string s, string t)
[Fact]
public Task TestInsertionLocation5()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -524,7 +524,7 @@ public C(string s, string t)
[Fact]
public Task TestInsertionLocation6()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -552,7 +552,7 @@ public C(string s, string t)
[Fact]
public Task TestInsertionLocation7()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -580,7 +580,7 @@ public C(string s, string t)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/19956")]
public Task TestNoBlock()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -603,7 +603,7 @@ public C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/29190")]
public Task TestInitializeFieldWithParameterNameSelected1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -628,7 +628,7 @@ public C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/29190")]
public Task TestInitializeField_ParameterNameSelected2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -653,7 +653,7 @@ public C(string s, int i)
[Fact]
public Task TestInitializeClassProperty_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -680,7 +680,7 @@ public C(int test, int test2)
[Fact]
public Task TestInitializeClassProperty_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -707,7 +707,7 @@ public C(int test, int test2)
[Fact]
public Task TestInitializeClassProperty_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -734,7 +734,7 @@ public C(int test, int test2)
[Fact]
public Task TestInitializeClassField_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -760,7 +760,7 @@ public C(int test, int test2)
[Fact]
public Task TestInitializeClassField_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -786,7 +786,7 @@ public C(int test, int test2)
[Fact]
public Task TestInitializeClassField_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -812,7 +812,7 @@ public C(int test, int test2)
[Fact]
public Task TestInitializeStructProperty_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S
{
@@ -835,7 +835,7 @@ public Test(int test)
[Fact]
public Task TestInitializeStructProperty_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S
{
@@ -858,7 +858,7 @@ public Test(int test)
[Fact]
public Task TestInitializeStructProperty_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S
{
@@ -881,7 +881,7 @@ public Test(int test)
[Fact]
public Task TestInitializeStructField_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S
{
@@ -904,7 +904,7 @@ public Test(int test)
[Fact]
public Task TestInitializeStructField_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S
{
@@ -927,7 +927,7 @@ public Test(int test)
[Fact]
public Task TestInitializeStructField_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S
{
@@ -950,7 +950,7 @@ public Test(int test)
[Fact]
public Task TestNoParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -973,7 +973,7 @@ public C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -996,7 +996,7 @@ public C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1019,7 +1019,7 @@ public C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1042,7 +1042,7 @@ public C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1065,7 +1065,7 @@ public C([||]string p_t_s)
[Fact]
public Task TestNoParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1088,7 +1088,7 @@ public C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1111,7 +1111,7 @@ public C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1134,7 +1134,7 @@ public C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1157,7 +1157,7 @@ public C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1180,7 +1180,7 @@ public C([||]string p_t_s_End)
[Fact]
public Task TestNoParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1205,7 +1205,7 @@ public C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1230,7 +1230,7 @@ public C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1255,7 +1255,7 @@ public C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1280,17 +1280,17 @@ public C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_InitializeField()
- => TestInRegularAndScript1Async(
-"""
-class C
-{
- private readonly string _s;
-
- public C([||]string p_t_s_End)
+ => TestInRegularAndScriptAsync(
+ """
+ class C
{
+ private readonly string _s;
+
+ public C([||]string p_t_s_End)
+ {
+ }
}
-}
-""",
+ """,
"""
class C
{
@@ -1305,7 +1305,7 @@ public C([||]string p_t_s_End)
[Fact]
public Task TestNoParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1330,7 +1330,7 @@ public C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1355,7 +1355,7 @@ public C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1380,7 +1380,7 @@ public C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1405,17 +1405,17 @@ public C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_InitializeProperty()
- => TestInRegularAndScript1Async(
-"""
-class C
-{
- public C([||]string p_t_s_End)
+ => TestInRegularAndScriptAsync(
+ """
+ class C
{
- }
+ public C([||]string p_t_s_End)
+ {
+ }
- public string S { get; }
-}
-""",
+ public string S { get; }
+ }
+ """,
"""
class C
{
@@ -1460,7 +1460,7 @@ public C([|string p__End, string p_test_t|])
[Fact]
public Task TestCreateFieldWithTopLevelNullability()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
#nullable enable
class C
@@ -1485,7 +1485,7 @@ public C(string? s)
[Fact]
public Task TestCreatePropertyWithTopLevelNullability()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
#nullable enable
class C
@@ -1510,7 +1510,7 @@ public C(string? s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/24526")]
public Task TestSingleLineBlock_BraceOnNextLine()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1547,11 +1547,11 @@ public C(string s) {
public string S { get; }
}
- """, options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Methods));
+ """, new(options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Methods)));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterFollowsExistingFieldAssignment()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1579,7 +1579,7 @@ public C(string s, int i)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterPrecedesExistingFieldAssignment()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1607,7 +1607,7 @@ public C(int i, string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterFollowsExistingFieldAssignment_TupleAssignment1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1636,7 +1636,7 @@ public C(string s, string t, int i)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterFollowsExistingFieldAssignment_TupleAssignment2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1661,7 +1661,7 @@ public C(string s, string t, int i) =>
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterFollowsExistingFieldAssignment_TupleAssignment3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1692,7 +1692,7 @@ public C(string s, string t, int i)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterPrecedesExistingFieldAssignment_TupleAssignment1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1721,7 +1721,7 @@ public C(int i, string s, string t)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterPrecedesExistingFieldAssignment_TupleAssignment2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1746,7 +1746,7 @@ public C(int i, string s, string t) =>
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterInMiddleOfExistingFieldAssignment_TupleAssignment1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1775,7 +1775,7 @@ public C(string s, int i, string t)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterInMiddleOfExistingFieldAssignment_TupleAssignment2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1800,7 +1800,7 @@ public C(string s, int i, string t) =>
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGeneratePropertyIfParameterFollowsExistingPropertyAssignment_TupleAssignment1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1846,7 +1846,7 @@ public static void M2([||]__arglist)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1873,7 +1873,7 @@ public C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1903,7 +1903,7 @@ public C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1933,7 +1933,7 @@ public C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields4()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1963,7 +1963,7 @@ public C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -1990,7 +1990,7 @@ public C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -2021,7 +2021,7 @@ public C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -2052,7 +2052,7 @@ public C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties4()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C
{
@@ -2109,7 +2109,7 @@ public Bar(int prop1, int [||]prop2) : base(prop1) { }
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -2138,7 +2138,7 @@ public C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -2173,7 +2173,7 @@ public C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -2208,7 +2208,7 @@ public C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty4()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -2245,7 +2245,7 @@ public C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty5()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -2282,7 +2282,7 @@ public C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty6()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs
index 8f3cab891e6c..221cb1910ebe 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/InitializeParameter/InitializeMemberFromPrimaryConstructorParameterTests.cs
@@ -29,7 +29,7 @@ protected override CodeRefactoringProvider CreateCodeRefactoringProvider(EditorT
[Fact]
public Task TestInitializeFieldWithSameName()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -45,7 +45,7 @@ class C(string s)
[Fact]
public Task TestEndOfParameter1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string s[||])
{
@@ -61,7 +61,7 @@ class C(string s)
[Fact]
public Task TestEndOfParameter2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string s[||], string t)
{
@@ -77,7 +77,7 @@ class C(string s, string t)
[Fact]
public Task TestInitializeFieldWithUnderscoreName()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -93,7 +93,7 @@ class C(string s)
[Fact]
public Task TestInitializeWritableProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -127,7 +127,7 @@ class C(string s)
[Fact]
public Task TestInitializeNonWritableProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -162,7 +162,7 @@ class C(string s)
[Fact]
public Task TestInitializeFieldWithWrongType1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -180,7 +180,7 @@ class C(string s)
[Fact]
public Task TestInitializeFieldWithWrongType2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -235,7 +235,7 @@ class C([||]string s)
[Fact]
public Task TestWhenAlreadyInitialized3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -254,7 +254,7 @@ class C([||]string s)
[Fact]
public Task TestInsertionLocation1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s, string t)
{
@@ -272,7 +272,7 @@ class C(string s, string t)
[Fact]
public Task TestInsertionLocation2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string s, [||]string t)
{
@@ -304,7 +304,7 @@ public void M([||]string s)
[Fact]
public Task TestInsertionLocation6()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string s, [||]string t)
{
@@ -321,7 +321,7 @@ class C(string s, string t)
[Fact]
public Task TestInsertionLocation7()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s, string t)
{
@@ -338,7 +338,7 @@ class C(string s, string t)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/19956")]
public Task TestNoBlock1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string s[||])
""",
@@ -352,7 +352,7 @@ class C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/19956")]
public Task TestNoBlock2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string s[||])
""",
@@ -367,7 +367,7 @@ class C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/29190")]
public Task TestInitializeFieldWithParameterNameSelected1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string [|s|])
{
@@ -383,7 +383,7 @@ class C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/29190")]
public Task TestInitializeField_ParameterNameSelected2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string [|s|], int i)
{
@@ -399,7 +399,7 @@ class C(string s, int i)
[Fact]
public Task TestInitializeClassProperty_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int test, int [|test2|])
{
@@ -417,7 +417,7 @@ class C(int test, int test2)
[Fact]
public Task TestInitializeClassProperty_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int test, int [|test2|])
{
@@ -435,7 +435,7 @@ class C(int test, int test2)
[Fact]
public Task TestInitializeClassProperty_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int test, int [|test2|])
{
@@ -453,7 +453,7 @@ class C(int test, int test2)
[Fact]
public Task TestInitializeClassField_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int test, int [|test2|])
{
@@ -470,7 +470,7 @@ class C(int test, int test2)
[Fact]
public Task TestInitializeClassField_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int test, int [|test2|])
{
@@ -487,7 +487,7 @@ class C(int test, int test2)
[Fact]
public Task TestInitializeClassField_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int test, int [|test2|])
{
@@ -504,7 +504,7 @@ class C(int test, int test2)
[Fact]
public Task TestInitializeStructProperty_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S(int [|test|])
{
@@ -519,7 +519,7 @@ struct S(int test)
[Fact]
public Task TestInitializeStructProperty_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S(int [|test|])
{
@@ -534,7 +534,7 @@ struct S(int test)
[Fact]
public Task TestInitializeStructProperty_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S(int [|test|])
{
@@ -549,7 +549,7 @@ struct S(int test)
[Fact]
public Task TestInitializeStructField_RequiredAccessibilityOmitIfDefault()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S(int [|test|])
{
@@ -564,7 +564,7 @@ struct S(int test)
[Fact]
public Task TestInitializeStructField_RequiredAccessibilityNever()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S(int [|test|])
{
@@ -579,7 +579,7 @@ struct S(int test)
[Fact]
public Task TestInitializeStructField_RequiredAccessibilityAlways()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
struct S(int [|test|])
{
@@ -594,7 +594,7 @@ struct S(int test)
[Fact]
public Task TestNoParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -609,7 +609,7 @@ class C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_s)
{
@@ -624,7 +624,7 @@ class C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_s_End)
{
@@ -639,7 +639,7 @@ class C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_p_s_End)
{
@@ -654,7 +654,7 @@ class C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_CreateAndInitField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_t_s)
{
@@ -669,7 +669,7 @@ class C([||]string p_t_s)
[Fact]
public Task TestNoParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -684,7 +684,7 @@ class C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_s)
{
@@ -699,7 +699,7 @@ class C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_s_End)
{
@@ -714,7 +714,7 @@ class C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_p_s_End)
{
@@ -729,7 +729,7 @@ class C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_CreateAndInitProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_t_s_End)
{
@@ -744,7 +744,7 @@ class C(string p_t_s_End)
[Fact]
public Task TestNoParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -760,7 +760,7 @@ class C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_s)
{
@@ -776,7 +776,7 @@ class C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_s_End)
{
@@ -792,7 +792,7 @@ class C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_p_s_End)
{
@@ -808,7 +808,7 @@ class C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_InitializeField()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_t_s_End)
{
@@ -824,7 +824,7 @@ class C([||]string p_t_s_End)
[Fact]
public Task TestNoParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s)
{
@@ -840,7 +840,7 @@ class C(string s)
[Fact]
public Task TestCommonParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_s)
{
@@ -856,7 +856,7 @@ class C(string t_s)
[Fact]
public Task TestSpecifiedParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_s_End)
{
@@ -872,7 +872,7 @@ class C(string p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string t_p_s_End)
{
@@ -888,7 +888,7 @@ class C(string t_p_s_End)
[Fact]
public Task TestCommonAndSpecifiedParameterNamingStyle2_InitializeProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string p_t_s_End)
{
@@ -923,7 +923,7 @@ class C([|string p__End, string p_test_t|])
[Fact]
public Task TestCreateFieldWithTopLevelNullability()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
#nullable enable
class C([||]string? s)
@@ -940,7 +940,7 @@ class C(string? s)
[Fact]
public Task TestCreatePropertyWithTopLevelNullability()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
#nullable enable
class C([||]string? s)
@@ -957,7 +957,7 @@ class C(string? s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/24526")]
public Task TestSingleLineBlock_BraceOnNextLine()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]string s) { }
""",
@@ -978,11 +978,11 @@ class C([||]string s) { }
class C(string s) {
public string S { get; } = s;
}
- """, options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Types));
+ """, new(options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Types)));
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterFollowsExistingFieldAssignment()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(string s, [||]int i)
{
@@ -999,7 +999,7 @@ class C(string s, int i)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/23308")]
public Task TestGenerateFieldIfParameterPrecedesExistingFieldAssignment()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]int i, string s)
{
@@ -1016,7 +1016,7 @@ class C(int i, string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]int i, int j, int k)
{
@@ -1033,7 +1033,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int i, [||]int j, int k)
{
@@ -1051,7 +1051,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]int i, int j, int k)
{
@@ -1069,7 +1069,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingFields4()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]int i, int j, int k)
{
@@ -1087,7 +1087,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]int i, int j, int k)
{
@@ -1104,7 +1104,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C(int i, [||]int j, int k)
{
@@ -1123,7 +1123,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]int i, int j, int k)
{
@@ -1142,7 +1142,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/35665")]
public Task TestGenerateRemainingProperties4()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
class C([||]int i, int j, int k)
{
@@ -1161,7 +1161,7 @@ class C(int i, int j, int k)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1181,7 +1181,7 @@ class C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1207,7 +1207,7 @@ private string S
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty3()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1233,7 +1233,7 @@ private string S
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty4()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1261,7 +1261,7 @@ private string S
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty5()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1289,7 +1289,7 @@ private string S
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/36998")]
public Task TestInitializeThrowingProperty6()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1351,7 +1351,7 @@ public partial class Goo
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/76565")]
public Task TestCouldInitializeThrowingProperty_ButGeneratePropertyInstead()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1373,7 +1373,7 @@ class C(string s)
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/76565")]
public Task TestCouldInitializeThrowingProperty_ButGenerateFieldInstead()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1395,7 +1395,7 @@ class C(string s)
[Fact]
public Task TestUpdateCodeToReferenceExistingField1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1427,7 +1427,7 @@ private void M()
[Fact]
public Task TestUpdateCodeToReferenceExistingField2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1459,7 +1459,7 @@ private void M()
[Fact]
public Task TestUpdateCodeToReferenceExistingProperty()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1491,7 +1491,7 @@ private void M()
[Fact]
public Task TestUpdateCodeToReferenceExistingProperty2()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1523,7 +1523,7 @@ private void M()
[Fact]
public Task TestUpdateCodeToReferenceNewProperty1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1553,7 +1553,7 @@ private void M()
[Fact]
public Task TestUpdateCodeToReferenceNewField1()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
using System;
@@ -1583,7 +1583,7 @@ private void M()
[Fact]
public Task TestInitializeIntoFieldInDifferentPart()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
partial class C([||]string s)
{
@@ -1607,7 +1607,7 @@ partial class C
[Fact]
public Task TestInitializeIntoPropertyInDifferentPart()
- => TestInRegularAndScript1Async(
+ => TestInRegularAndScriptAsync(
"""
partial class C([||]string s)
{
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveScope.cs b/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveScope.cs
index 0f2d0407493a..f8dbeb9ac52f 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveScope.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveScope.cs
@@ -20,8 +20,7 @@ public partial class MoveTypeTests : CSharpMoveTypeTestsBase
{
[Fact]
public Task MoveType_NamespaceScope_SingleItem()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
class [||]Class1
@@ -36,12 +35,10 @@ class Class1
}
}
""", expectOperation: false);
- }
[Fact]
public Task MoveType_NamespaceScope_SingleItemNamespaceComment()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
// Comment on the namespace
namespace N1
{
@@ -58,12 +55,10 @@ class Class1
}
}
""", expectOperation: false);
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtTop()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
class [||]Class1
@@ -89,12 +84,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtTopNamespaceComment()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
// Comment on the namespace
namespace N1
{
@@ -122,12 +115,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtTopWithComments()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
// Class1 Comment
@@ -157,12 +148,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtTopWithXmlComments()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
///
@@ -200,12 +189,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtBottom()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
class Class1
@@ -231,12 +218,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtBottomNamespaceComments()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
// Comment on the namespace
namespace N1
{
@@ -264,12 +249,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtBottomWithComments()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
// Class1 comment
@@ -299,12 +282,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemAtBottomWithXmlComments()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
///
@@ -342,12 +323,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemInMiddle()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
class Class1
@@ -400,12 +379,10 @@ class Class5
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemInMiddleNamespaceComment()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
// Comment on the namespace
namespace N1
{
@@ -460,12 +437,10 @@ class Class5
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemInMiddleWithComments()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
// Class1 comment
@@ -528,12 +503,10 @@ class Class5
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemInMiddleWithXmlComments()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
///
@@ -616,12 +589,10 @@ class Class5
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_ItemInMiddleWithInterface()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
// Class1 comment
@@ -688,12 +659,10 @@ class Class5
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_TwoItemsInDifferentNamespace()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
class [||]Class1
@@ -722,12 +691,10 @@ class Class2
}
}
""", expectOperation: false);
- }
[Fact]
public Task MoveType_NamespaceScope_ItemsInDifferentNamespace()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
interface IClass1
@@ -767,12 +734,10 @@ class Class2
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_NestedNamespaces()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
namespace N2
@@ -812,12 +777,10 @@ class C3
}
}
""");
- }
[Fact]
public Task MoveType_NamespaceScope_NestedNamespaces2()
- {
- return TestNamespaceMove("""
+ => TestNamespaceMove("""
namespace N1
{
namespace N2
@@ -874,7 +837,6 @@ class C4
}
}
""");
- }
private async Task TestNamespaceMove(string originalCode, string expectedCode, bool expectOperation = true)
{
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/PreviewExceptionTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/PreviewExceptionTests.cs
index ad5cbb59f472..7a9ced1875ec 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/PreviewExceptionTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/PreviewExceptionTests.cs
@@ -25,7 +25,7 @@ public sealed partial class PreviewTests
[WpfFact]
public async Task TestExceptionInComputePreview()
{
- using var workspace = CreateWorkspaceFromOptions("class D {}", new TestParameters());
+ using var workspace = CreateWorkspaceFromOptions("class D {}", TestParameters.Default);
var errorReportingService = (TestErrorReportingService)workspace.Services.GetRequiredService();
var errorReported = false;
@@ -38,7 +38,7 @@ public async Task TestExceptionInComputePreview()
[WpfFact]
public void TestExceptionInDisplayText()
{
- using var workspace = CreateWorkspaceFromOptions("class D {}", new TestParameters());
+ using var workspace = CreateWorkspaceFromOptions("class D {}", TestParameters.Default);
var errorReportingService = (TestErrorReportingService)workspace.Services.GetRequiredService();
var errorReported = false;
@@ -51,7 +51,7 @@ public void TestExceptionInDisplayText()
[WpfFact]
public async Task TestExceptionInActionSets()
{
- using var workspace = CreateWorkspaceFromOptions("class D {}", new TestParameters());
+ using var workspace = CreateWorkspaceFromOptions("class D {}", TestParameters.Default);
var errorReportingService = (TestErrorReportingService)workspace.Services.GetRequiredService();
var errorReported = false;
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/PreviewTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/PreviewTests.cs
index 8ca877748d2f..abb67d2e918a 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/PreviewTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/PreviewTests.cs
@@ -106,7 +106,7 @@ protected override Task GetChangedSolutionAsync(
[WpfFact]
public async Task TestPickTheRightPreview_NoPreference()
{
- var parameters = new TestParameters();
+ var parameters = TestParameters.Default;
using var workspace = CreateWorkspaceFromOptions("class D {}", parameters);
var (document, previews) = await GetMainDocumentAndPreviewsAsync(parameters, workspace);
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs
index 7fbbb97bc092..88f61b443467 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/PullMemberUp/CSharpPullMemberUpTests.cs
@@ -3704,8 +3704,7 @@ public Goo(String s)
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullMethodToClassWithDirective()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3729,12 +3728,10 @@ public class Bar : BaseClass
#endregion
}
""");
- }
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullMethodToClassBeforeDirective()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3759,12 +3756,10 @@ public void Goo() { }
#endregion
}
""");
- }
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullMethodToClassBeforeDirective2()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3792,12 +3787,10 @@ public void Hello() { }
#endregion
}
""");
- }
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullFieldToClassBeforeDirective1()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3822,12 +3815,10 @@ public class Bar : BaseClass
#endregion
}
""");
- }
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullFieldToClassBeforeDirective2()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3853,12 +3844,10 @@ public class Bar : BaseClass
#endregion
}
""");
- }
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullFieldToClassBeforeDirective()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3882,12 +3871,10 @@ public class Bar : BaseClass
#endregion
}
""");
- }
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullEventToClassBeforeDirective()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
using System;
public class BaseClass
{
@@ -3913,12 +3900,10 @@ public class Bar : BaseClass
#endregion
}
""");
- }
[Fact, WorkItem(55746, "https://github.com/dotnet/roslyn/issues/51531")]
public Task TestPullPropertyToClassBeforeDirective()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3942,12 +3927,10 @@ public class Bar : BaseClass
#endregion
}
""");
- }
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/55402")]
public Task TestPullPropertyToClassOnKeyword()
- {
- return TestWithPullMemberDialogAsync("""
+ => TestWithPullMemberDialogAsync("""
public class BaseClass
{
}
@@ -3966,7 +3949,6 @@ public class Derived : BaseClass
{
}
""");
- }
#endregion Quick Action
@@ -3983,7 +3965,7 @@ internal Task TestWithPullMemberDialogAsync(
{
var service = new TestPullMemberUpService(selection, destinationName);
- return TestInRegularAndScript1Async(
+ return TestInRegularAndScriptAsync(
initialMarkUp, expectedResult,
(parameters ?? TestParameters.Default).WithFixProviderData(service).WithOptions(options).WithIndex(index));
}
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/SyncNamespace/CSharpSyncNamespaceTestsBase.cs b/src/EditorFeatures/CSharpTest/CodeActions/SyncNamespace/CSharpSyncNamespaceTestsBase.cs
index 52708bf17e7d..1502807b2c5e 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/SyncNamespace/CSharpSyncNamespaceTestsBase.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/SyncNamespace/CSharpSyncNamespaceTestsBase.cs
@@ -58,7 +58,7 @@ protected static string CreateFolderPath(params string[] folders)
protected async Task TestMoveFileToMatchNamespace(string initialMarkup, List expectedFolders = null)
{
- var testOptions = new TestParameters();
+ var testOptions = TestParameters.Default;
using (var workspace = (EditorTestWorkspace)CreateWorkspaceFromOptions(initialMarkup, testOptions))
{
if (expectedFolders?.Count > 0)
@@ -136,7 +136,7 @@ protected async Task TestChangeNamespaceAsync(
string expectedSourceOriginal,
string expectedSourceReference = null)
{
- var testOptions = new TestParameters();
+ var testOptions = TestParameters.Default;
using (var workspace = CreateWorkspaceFromOptions(initialMarkUp, testOptions))
{
if (workspace.Projects.Count == 2)
diff --git a/src/EditorFeatures/CSharpTest/CodeLens/CSharpCodeLensTests.cs b/src/EditorFeatures/CSharpTest/CodeLens/CSharpCodeLensTests.cs
index dca07b4e0215..ae383dd7bc91 100644
--- a/src/EditorFeatures/CSharpTest/CodeLens/CSharpCodeLensTests.cs
+++ b/src/EditorFeatures/CSharpTest/CodeLens/CSharpCodeLensTests.cs
@@ -16,9 +16,8 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeLens;
public sealed class CSharpCodeLensTests : AbstractCodeLensTest
{
[Fact]
- public async Task TestCount()
- {
- const string input = """
+ public Task TestCount()
+ => RunCountTest("""
- """;
- await RunCountTest(input);
- }
+ """);
[Fact]
- public async Task TestCapping()
- {
- const string input = """
+ public Task TestCapping()
+ => RunCountTest("""
- """;
-
- await RunCountTest(input, 1);
- }
+ """, 1);
[Fact]
- public async Task TestLinkedFiles()
- {
- const string input = """
+ public Task TestLinkedFiles()
+ => RunReferenceTest("""
- """;
-
- await RunReferenceTest(input);
- }
+ """);
[Fact]
- public async Task TestDisplay()
- {
- const string input = """
+ public Task TestDisplay()
+ => RunReferenceTest("""
- """;
-
- await RunReferenceTest(input);
- }
+ """);
[Fact]
- public async Task TestMethodReferences()
- {
- const string input = """
+ public Task TestMethodReferences()
+ => RunMethodReferenceTest("""
- """;
- await RunMethodReferenceTest(input);
- }
+ """);
[Fact]
- public async Task TestMethodReferencesWithDocstrings()
- {
- const string input = """
+ public Task TestMethodReferencesWithDocstrings()
+ => RunMethodReferenceTest("""
- """;
- await RunMethodReferenceTest(input);
- }
+ """);
[Theory]
[InlineData("class")]
@@ -267,9 +246,8 @@ public Task TestFullyQualifiedName(string typeKind)
""");
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/49636")]
- public async Task TestExplicitParameterlessConstructor()
- {
- const string input = """
+ public Task TestExplicitParameterlessConstructor()
+ => RunReferenceTest("""
- """;
- await RunReferenceTest(input);
- }
+ """);
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/49636")]
- public async Task TestExplicitParameterlessConstructor_TwoCalls()
- {
- const string input = """
+ public Task TestExplicitParameterlessConstructor_TwoCalls()
+ => RunReferenceTest("""
- """;
- await RunReferenceTest(input);
- }
+ """);
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/49636")]
- public async Task TestImplicitParameterlessConstructor()
- {
- const string input = """
+ public Task TestImplicitParameterlessConstructor()
+ => RunReferenceTest("""
- """;
- await RunReferenceTest(input);
- }
+ """);
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/49636")]
- public async Task TestImplicitParameterlessConstructor_TwoCalls()
- {
- const string input = """
+ public Task TestImplicitParameterlessConstructor_TwoCalls()
+ => RunReferenceTest("""
- """;
- await RunReferenceTest(input);
- }
+ """);
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/51633")]
- public async Task TestMethodRefSourceGeneratedDocument()
- {
- const string input = """
+ public Task TestMethodRefSourceGeneratedDocument()
+ => RunMethodReferenceTest("""
- """;
- await RunMethodReferenceTest(input);
- }
+ """);
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/64592")]
- public async Task TestFileScopedTypes()
- {
- const string input = """
+ public Task TestFileScopedTypes()
+ => RunReferenceTest("""
- """;
- await RunReferenceTest(input);
- }
+ """);
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67956")]
- public async Task TestConstructorReferencesInOtherProject()
- {
- const string input = """
+ public Task TestConstructorReferencesInOtherProject()
+ => RunReferenceTest("""
- """;
- await RunReferenceTest(input);
- }
+ """);
}
diff --git a/src/EditorFeatures/CSharpTest/CommentSelection/CSharpCommentSelectionTests.cs b/src/EditorFeatures/CSharpTest/CommentSelection/CSharpCommentSelectionTests.cs
index 2e4973741f2e..e7a694242a26 100644
--- a/src/EditorFeatures/CSharpTest/CommentSelection/CSharpCommentSelectionTests.cs
+++ b/src/EditorFeatures/CSharpTest/CommentSelection/CSharpCommentSelectionTests.cs
@@ -25,8 +25,7 @@ public sealed class CSharpCommentSelectionTests
{
[WpfFact]
public void UncommentAndFormat1()
- {
- UncommentSelection("""
+ => UncommentSelection("""
class A
{
[| // void Method ( )
@@ -43,12 +42,10 @@ void Method()
}
}
""");
- }
[WpfFact]
public void UncommentAndFormat2()
- {
- UncommentSelection("""
+ => UncommentSelection("""
class A
{
[| /* void Method ( )
@@ -65,12 +62,10 @@ void Method()
}
}
""");
- }
[WpfFact]
public void UncommentSingleLineCommentInPseudoBlockComment()
- {
- UncommentSelection("""
+ => UncommentSelection("""
class C
{
///
@@ -91,12 +86,10 @@ protected void RtlTranslateAlignment2()
/* Hello world */
}
""");
- }
[WpfFact]
public void UncommentAndFormat3()
- {
- UncommentSelection("""
+ => UncommentSelection("""
class A
{
[| // void Method ( ) |]
@@ -113,7 +106,6 @@ void Method()
}
}
""");
- }
private static void UncommentSelection(string markup, string expected)
{
diff --git a/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs b/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs
index 428a97e70189..b7e2f08026e0 100644
--- a/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs
+++ b/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs
@@ -22,8 +22,7 @@ public sealed class CSharpToggleBlockCommentCommandHandlerTests : AbstractToggle
{
[WpfFact]
public void AddComment_CommentMarkerStringBeforeSelection()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -44,12 +43,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_DirectiveWithCommentInsideSelection()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -74,12 +71,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MarkerInsideSelection()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -100,12 +95,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_CloseCommentMarkerStringInSelection()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -126,12 +119,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_CommentMarkerStringAfterSelection()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -152,12 +143,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CommentMarkerStringNearSelection()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -180,12 +169,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CommentMarkerStringInSelection()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -202,7 +189,6 @@ void M()
}
}
""");
- }
internal override AbstractCommentSelectionBase GetToggleCommentCommandHandler(EditorTestWorkspace workspace)
{
diff --git a/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleLineCommentCommandHandlerTests.cs b/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleLineCommentCommandHandlerTests.cs
index 8612d90b926b..dd7bdc365c19 100644
--- a/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleLineCommentCommandHandlerTests.cs
+++ b/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleLineCommentCommandHandlerTests.cs
@@ -21,20 +21,15 @@ public sealed class CSharpToggleLineCommentCommandHandlerTests : AbstractToggleC
{
[WpfFact]
public void AddComment_EmptyCaret()
- {
- ToggleComment(@"$$", @"[||]");
- }
+ => ToggleComment(@"$$", @"[||]");
[WpfFact]
public void AddComment_EmptySelection()
- {
- ToggleComment(@"[| |]", @"[||]");
- }
+ => ToggleComment(@"[| |]", @"[||]");
[WpfFact]
public void AddComment_CaretInUncommentedLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -51,12 +46,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_CaretBeforeUncommentedLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -73,12 +66,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_SingleLineSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -95,12 +86,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_PartialSingleLineSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -117,12 +106,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_SingleLineWithWhitespaceSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -143,12 +130,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_SelectionInsideCommentAtEndOfLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -165,12 +150,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_SelectionAroundCommentAtEndOfLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -187,12 +170,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_SelectionOutsideCommentAtEndOfLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -209,12 +190,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_CaretOutsideCommentAtEndOfLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -231,12 +210,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_CaretInsideCommentAtEndOfLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -253,12 +230,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_CommentMarkerInString()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -275,12 +250,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MultipleLinesSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -299,12 +272,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MultipleLinesWithWhitespaceSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -329,12 +300,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MultipleLinesPartiallyCommentedSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -353,12 +322,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MultipleLinesWithCommentsInLineSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -377,12 +344,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MultipleLinesWithDifferentIndentationsSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
[| void M()
@@ -403,12 +368,10 @@ class C
//}|]
}
""");
- }
[WpfFact]
public void AddComment_MultiCaret()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -427,12 +390,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MultiSeletion()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -451,12 +412,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_MultiSeletionPartiallyCommented()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -475,12 +434,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void AddComment_WithProjectionBuffer()
- {
- ToggleCommentWithProjectionBuffer(@"< html >@{|S1:|}", """
+ => ToggleCommentWithProjectionBuffer(@"< html >@{|S1:|}", """
{|S1:class C
{
void M()
@@ -497,12 +454,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CaretInCommentedLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -519,12 +474,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CaretBeforeCommentedLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -541,12 +494,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CaretInCommentedLineWithEndComment()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -563,12 +514,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CaretInDoubleCommentedLine()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -585,12 +534,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CommentedLineSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -607,12 +554,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_InsideCommentSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -629,12 +574,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CommentedLineWithWhitespaceSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -655,12 +598,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_CommentMarkerInString()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -677,12 +618,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_MultipleCommentedLinesSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -701,12 +640,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_MultipleCommentedLinesAndWhitespaceSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -731,12 +668,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_MultipleCommentedLinesWithEndCommentSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -755,12 +690,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_MultipleLinesWithDifferentIndentationsSelected()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
[| //void M()
@@ -781,12 +714,10 @@ class C
}|]
}
""");
- }
[WpfFact]
public void RemoveComment_MultiCaret()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -807,12 +738,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_MultiSeletion()
- {
- ToggleComment("""
+ => ToggleComment("""
class C
{
void M()
@@ -833,12 +762,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void RemoveComment_WithProjectionBuffer()
- {
- ToggleCommentWithProjectionBuffer(@"< html >@{|S1:|}", """
+ => ToggleCommentWithProjectionBuffer(@"< html >@{|S1:|}", """
{|S1:class C
{
void M()
@@ -855,7 +782,6 @@ void M()
}
}
""");
- }
[WpfFact]
public void ToggleComment_MultipleLinesSelected()
diff --git a/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs b/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs
index 4f5666a30a46..416e7b2bad44 100644
--- a/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs
+++ b/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs
@@ -66,8 +66,7 @@ internal static int MethodM(int a, int b)
[InlineData("public interface C(int X, int$$ Y)", "public interface C(int X, int Y)")]
[InlineData("public interface C(int X, int Y$$)", "public interface C(int X, int Y)")]
public void ParameterList_CouldBeHandled(string signature, string expectedSignature)
- {
- VerifyTypingSemicolon($$"""
+ => VerifyTypingSemicolon($$"""
public class Class1
{
{{signature}}
@@ -78,12 +77,10 @@ public class Class1
{{expectedSignature}};$$
}
""");
- }
[WpfFact]
public void ParameterList_InterfaceMethod()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public interface I
{
public void M(object o$$)
@@ -94,7 +91,6 @@ public interface I
public void M(object o);$$
}
""");
- }
[WpfTheory]
[InlineData("void M$$(object o)")]
@@ -103,14 +99,12 @@ public interface I
[InlineData("void Method($$object o")]
[InlineData("partial void Method($$object o) { }")]
public void ParameterList_NotHandled(string signature)
- {
- VerifyNoSpecialSemicolonHandling($$"""
+ => VerifyNoSpecialSemicolonHandling($$"""
public class Class1
{
{{signature}}
}
""");
- }
#endregion
@@ -731,19 +725,16 @@ public void ArgumentList_Array_MissingInner()
[WpfFact]
public void FieldInitializer_NoParens()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
int i = 4$$
int j = 5;
""");
- }
[WpfFact]
public void FieldInitializer2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
int i = Min(2$$,3)
@@ -754,23 +745,19 @@ class C
int i = Min(2,3);$$
int j = 5;
""");
- }
[WpfFact]
public void FieldInitializer2b_MissingParen()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
int i = Min(2$$,3
int j = 5;
""");
- }
[WpfFact]
public void FieldInitializer3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
int i = Min(Max(4,5$$),3)
@@ -781,18 +768,15 @@ class C
int i = Min(Max(4,5),3);$$
int j = 5;
""");
- }
[WpfFact]
public void FieldInitializer3b_MissingInner()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
int i = Min(Max(4,5$$,3)
int j = 5;
""");
- }
#endregion
@@ -800,8 +784,7 @@ class C
[WpfFact]
public void ForLoopSingleInitializer1()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -809,12 +792,10 @@ static void Main()
for (int i = 0$$ )
int j;
""");
- }
[WpfFact]
public void ForLoopSingleInitializer2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -822,12 +803,10 @@ static void Main()
for (int i = 0$$ i < 5; i++)
int j;
""");
- }
[WpfFact]
public void ForLoopSingleInitializer3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -840,12 +819,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void ForLoopSingleInitializer_MissingParen()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -853,12 +830,10 @@ static void Main()
for (int i = 0$$
int j;
""");
- }
[WpfFact]
public void ForLoopNoStatements()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -866,12 +841,10 @@ static void Main()
for ($$
int j;
""");
- }
[WpfFact]
public void ForLoopNoStatements2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -879,12 +852,10 @@ static void Main()
for ( $$
int j;
""");
- }
[WpfFact]
public void ForLoopNoStatements3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -892,12 +863,10 @@ static void Main()
for ( ; $$
int j;
""");
- }
[WpfFact]
public void ForLoopNoStatements4()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -905,12 +874,10 @@ static void Main()
for ( ; ;$$
int j;
""");
- }
[WpfFact]
public void ForLoopNoStatements5()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -918,12 +885,10 @@ static void Main()
for ( $$ ;)
int j;
""");
- }
[WpfFact]
public void ForLoopMultistatementInitializer1()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -931,12 +896,10 @@ static void Main()
for ( $$int i = 0, int j = 0)
int j;
""");
- }
[WpfFact]
public void ForLoopMultistatementInitializer2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -944,12 +907,10 @@ static void Main()
for ( int$$ i = 0, int j = 0)
int j;
""");
- }
[WpfFact]
public void ForLoopMultistatementInitializer3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -957,12 +918,10 @@ static void Main()
for ( int i$$ = 0, int j = 0)
int j;
""");
- }
[WpfFact]
public void ForLoopMultistatementInitializer4()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -970,12 +929,10 @@ static void Main()
for ( int i = 0, $$int j = 0)
int j;
""");
- }
[WpfFact]
public void ForLoopMultistatementInitializer5()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -983,12 +940,10 @@ static void Main()
for ( int i = 0, int j =$$ 0)
int j;
""");
- }
[WpfFact]
public void ForLoopMultistatementInitializer6()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -996,12 +951,10 @@ static void Main()
for ( int i = 0, int j = 0$$)
int j;
""");
- }
[WpfFact]
public void ForLoopMultistatementInitializer7()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main()
@@ -1009,12 +962,10 @@ static void Main()
for ( int i = 0, int j = 0$$)
int j;
""");
- }
[WpfFact]
public void ForLoopNewInInitializer1()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1047,12 +998,10 @@ public class C1
}
}
""");
- }
[WpfFact]
public void ForLoopNewInInitializer_MissingOneParen()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1069,7 +1018,6 @@ public class C1
}
}
""");
- }
[WpfFact]
public void ForLoopNewInInitializer2_MissingBothParens()
@@ -1097,8 +1045,7 @@ public class C1
[WpfFact]
public void ForLoopDeclaration()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1113,12 +1060,10 @@ static void Main(string[] args)
string s = "abcdefghij";
for (int i = s.IndexOf("bcd");$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopDeclaration2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1133,12 +1078,10 @@ static void Main(string[] args)
string s = "abcdefghij";
for (int i = s.IndexOf("bcd"), j=1;$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopDeclaration3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1153,12 +1096,10 @@ static void Main(string[] args)
string s = "abcdefghij";
for (int i = s.IndexOf("bcd");$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopDeclaration4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1173,12 +1114,10 @@ static void Main(string[] args)
string s = "abcdefghij";
for (int i = s.IndexOf("bcd"), j=1;$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopDeclaration_MissingParen()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1193,12 +1132,10 @@ static void Main(string[] args)
string s = "abcdefghij";
for (int i = s.IndexOf("bcd";$$ i < 10; i++)
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/32250")]
public void ForLoopInitializers()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1215,12 +1152,10 @@ static void Main(string[] args)
int i;
for (i = s.IndexOf("bcd");$$ i < 10; i++)
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/32250")]
public void ForLoopInitializers2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1239,12 +1174,10 @@ static void Main(string[] args)
int j;
for (i = s.IndexOf("bcd"), j=1;$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopInitializers3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1261,12 +1194,10 @@ static void Main(string[] args)
int i;
for (i = s.IndexOf("bcd");$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopInitializers4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1285,11 +1216,9 @@ static void Main(string[] args)
int j;
for (i = s.IndexOf("bcd"), j=1;$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopInitializers_MissingParen()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1306,12 +1235,10 @@ static void Main(string[] args)
int i;
for (i = s.IndexOf("bcd";$$ i < 10; i++)
""");
- }
[WpfFact]
public void ForLoopCondition()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1326,12 +1253,10 @@ static void Main(string[] args)
string s = "abcdefghij";
for (int i = s.IndexOf("bcd"); i < s.IndexOf("x");$$ i++)
""");
- }
[WpfFact]
public void ForLoopConditionIsNull()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1341,12 +1266,10 @@ static void Main(string[] args)
Console.WriteLine("test");
}
""");
- }
[WpfFact]
public void ForLoopConditionIsNull2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1365,12 +1288,10 @@ static void Main(string[] args)
Console.WriteLine("test");
}
""");
- }
[WpfFact]
public void ForLoopIncrement()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1385,12 +1306,10 @@ static void Main(string[] args)
string s = "abcdefghij";
for (int i = s.IndexOf("bcd"); i < s.IndexOf("x"); i = i.IndexOf("x";$$))
""");
- }
[WpfFact]
public void ForLoopBody()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1411,12 +1330,10 @@ static void Main(string[] args)
i.ToString();$$
}
""");
- }
[WpfFact]
public void ForLoopObjectInitializer_MissingParen()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1430,12 +1347,10 @@ public class Goo
public string s;
}
""");
- }
[WpfFact]
public void ForLoopObjectInitializer()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1462,12 +1377,10 @@ public class Goo
public string s;
}
""");
- }
[WpfFact]
public void ForLoopObjectInitializer_MissingBrace()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1481,7 +1394,6 @@ public class Goo
public string s;
}
""");
- }
#endregion
@@ -1489,8 +1401,7 @@ public class Goo
[WpfFact]
public void Indexer()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class SampleCollection
{
private T[] arr = new T[100];
@@ -1513,12 +1424,10 @@ public int Property
}
}
""");
- }
[WpfFact]
public void Indexer2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class test
{
int[] array = { 1, 2, 3 };
@@ -1539,12 +1448,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void Indexer3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
int[] array = { 1, 2, 3 };
@@ -1565,12 +1472,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void Indexer4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
int[] array = { 1, 2, 3 };
@@ -1591,7 +1496,6 @@ void M()
}
}
""");
- }
#endregion
@@ -1599,8 +1503,7 @@ void M()
[WpfFact]
public void ArrayInitializer()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1610,12 +1513,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ArrayInitializer2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1634,12 +1535,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ArrayInitializer3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1658,12 +1557,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ArrayInitializer4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1682,12 +1579,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ArrayInitializer_MissingBrace()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1697,7 +1592,6 @@ static void Main(string[] args)
}
""");
- }
#endregion
@@ -1705,8 +1599,7 @@ static void Main(string[] args)
[WpfFact]
public void ImplicitTypeArrayInitializer()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1716,12 +1609,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ImplicitTypeArrayInitializer2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1740,12 +1631,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ImplicitTypeArrayInitializer3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1764,12 +1653,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ImplicitTypeArrayInitializer4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1788,12 +1675,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void ImplicitTypeArrayInitializer_MissingBrace()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1803,7 +1688,6 @@ static void Main(string[] args)
}
""");
- }
#endregion
@@ -1811,8 +1695,7 @@ static void Main(string[] args)
[WpfFact]
public void CollectionExpression()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1822,12 +1705,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionExpression2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1846,12 +1727,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionExpression3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1870,12 +1749,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionExpression4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -1894,12 +1771,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionExpression_MissingBrace()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -1909,7 +1784,6 @@ static void Main(string[] args)
}
""");
- }
#endregion
@@ -1917,8 +1791,7 @@ static void Main(string[] args)
[WpfFact]
public void CollectionInitializer()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System.Collections.Generic;
class C
{
@@ -1929,12 +1802,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionInitializer2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System.Collections.Generic;
class C
{
@@ -1955,12 +1826,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionInitializer3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System.Collections.Generic;
class C
{
@@ -1981,12 +1850,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionInitializer4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System.Collections.Generic;
class C
{
@@ -2007,12 +1874,10 @@ static void Main(string[] args)
}
""");
- }
[WpfFact]
public void CollectionInitializer_MissingBrace()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System.Collections.Generic;
class C
{
@@ -2023,7 +1888,6 @@ static void Main(string[] args)
}
""");
- }
#endregion
@@ -2031,8 +1895,7 @@ static void Main(string[] args)
[WpfFact]
public void ObjectInitializer()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
static void Main(string[] args)
@@ -2047,12 +1910,10 @@ public class Goo
public string s;
}
""");
- }
[WpfFact]
public void ObjectInitializer2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -2081,12 +1942,10 @@ public class Goo
public string s;
}
""");
- }
[WpfFact]
public void ObjectInitializer3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -2115,12 +1974,10 @@ public class Goo
public string s;
}
""");
- }
[WpfFact]
public void ObjectInitializer4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -2149,12 +2006,10 @@ public class Goo
public string s;
}
""");
- }
[WpfFact]
public void ObjectInitializer_MissingBrace()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
static void Main(string[] args)
@@ -2183,7 +2038,6 @@ public class Goo
public string s;
}
""");
- }
#endregion
@@ -2191,8 +2045,7 @@ public class Goo
[WpfFact]
public void PropertyAccessors1()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class ClassC
{
private int xValue = 7;
@@ -2217,12 +2070,10 @@ public int XValue
}
}
""");
- }
[WpfFact]
public void PropertyAccessors2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class ClassC
{
private int xValue = 7;
@@ -2247,12 +2098,10 @@ public int XValue
}
}
""");
- }
[WpfFact]
public void PropertyAccessors3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class Person
{
private string firstName;
@@ -2267,12 +2116,10 @@ public Person(string first, string last)
public string Name => $"{firstName} {lastName}"$$
}
""");
- }
[WpfFact]
public void PropertyAccessors4()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class SaleItem
{
string name;
@@ -2283,12 +2130,10 @@ public string Name
}
}
""");
- }
[WpfFact]
public void PropertyAccessors5()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class SaleItem
{
string name;
@@ -2299,12 +2144,10 @@ public string Name
}
}
""");
- }
[WpfFact]
public void PropertyAccessors6()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class SaleItem
{
string name;
@@ -2325,24 +2168,20 @@ public string Name
}
}
""");
- }
[WpfFact]
public void PropertyAccessors7()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class SaleItem
{
public string Name
{ get$$ set; }
}
""");
- }
[WpfFact]
public void PropertyInitializer1()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class C
{
public static C MyProp { get; } = new C($$)
@@ -2353,12 +2192,10 @@ public class C
public static C MyProp { get; } = new C();$$
}
""");
- }
[WpfFact]
public void PropertyAttribute1()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class C
{
public int P
@@ -2371,7 +2208,6 @@ public int P
}
}
""");
- }
#endregion
@@ -2379,8 +2215,7 @@ public int P
[WpfFact]
public void ParenthesizedExpression_Assignment1()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2397,12 +2232,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_Assignment2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2419,12 +2252,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_Assignment3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2443,12 +2274,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_ForLoop()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2471,12 +2300,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_ForLoop2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2499,12 +2326,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_ForLoop3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2527,12 +2352,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_ForEach()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class Class1
{
static void Main(string[] args)
@@ -2550,12 +2373,10 @@ private static int[] M(int i)
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_GoTo2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
static void Main()
{
int n = 1;
@@ -2584,12 +2405,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_Switch()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
static void Main()
@@ -2605,12 +2424,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_Switch2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
static void Main()
@@ -2626,12 +2443,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_Switch3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class Program
{
static void Main()
@@ -2664,12 +2479,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_While()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System;
class Program
{
@@ -2683,12 +2496,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_While2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System;
class Program
{
@@ -2702,12 +2513,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void ParenthesizedExpression_While3()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System;
class Program
{
@@ -2734,7 +2543,6 @@ static void Main()
}
}
""");
- }
#endregion
@@ -2742,8 +2550,7 @@ static void Main()
[InlineData("default(object$$)", "default(object)")]
[InlineData("default($$object)", "default(object)")]
public void DefaultExpression_Handled(string expression, string expectedExpression)
- {
- VerifyTypingSemicolon($$"""
+ => VerifyTypingSemicolon($$"""
public class Class1
{
void M()
@@ -2760,14 +2567,12 @@ void M()
}
}
""");
- }
[WpfTheory, WorkItem("https://github.com/dotnet/roslyn/issues/52137")]
[InlineData("typeof(object$$)", "typeof(object)")]
[InlineData("typeof($$object)", "typeof(object)")]
public void TypeOfExpression_Handled(string expression, string expectedExpression)
- {
- VerifyTypingSemicolon($$"""
+ => VerifyTypingSemicolon($$"""
public class Class1
{
void M()
@@ -2784,12 +2589,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/52365")]
public void TupleExpression_Handled()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2806,7 +2609,6 @@ void M()
}
}
""");
- }
[WpfTheory]
[InlineData("default$$(object)")]
@@ -2814,8 +2616,7 @@ void M()
[InlineData("default(object$$")]
[InlineData("default($$object")]
public void DefaultExpression_NotHandled(string expression)
- {
- VerifyNoSpecialSemicolonHandling($$"""
+ => VerifyNoSpecialSemicolonHandling($$"""
public class Class1
{
void M()
@@ -2824,7 +2625,6 @@ void M()
}
}
""");
- }
[WpfTheory]
[InlineData("checked(3 + 3$$)", "checked(3 + 3)")]
@@ -2832,8 +2632,7 @@ void M()
[InlineData("unchecked(3 + 3$$)", "unchecked(3 + 3)")]
[InlineData("unchecked($$3 + 3)", "unchecked(3 + 3)")]
public void CheckedExpression_Handled(string expression, string expectedExpression)
- {
- VerifyTypingSemicolon($$"""
+ => VerifyTypingSemicolon($$"""
public class Class1
{
void M()
@@ -2850,7 +2649,6 @@ void M()
}
}
""");
- }
[WpfTheory]
[InlineData("checked$$(3 + 3)")]
@@ -2862,8 +2660,7 @@ void M()
[InlineData("unchecked(3 + 3$$")]
[InlineData("unchecked($$3 + 3")]
public void CheckedExpression_NotHandled(string expression)
- {
- VerifyNoSpecialSemicolonHandling($$"""
+ => VerifyNoSpecialSemicolonHandling($$"""
public class Class1
{
void M()
@@ -2872,12 +2669,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ThrowStatement_MissingBoth()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class Class1
{
void M()
@@ -2888,12 +2683,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void ThrowStatement()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class Class1
{
void M()
@@ -2914,34 +2707,28 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_SemicolonBeforeClassDeclaration()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
$$
class C
{
}
""");
- }
[WpfFact]
public void DoNotCompleteStatment_DocComments()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
/// Testing $$
class C
{
}
""");
- }
[WpfFact]
public void DoNotComplete_FormatString()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
void Main()
@@ -2950,12 +2737,10 @@ void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_EmptyStatement()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
void Main()
@@ -2964,12 +2749,10 @@ void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_EmptyStatement2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
void Main()
@@ -2978,12 +2761,10 @@ void Main()
}
}
""");
- }
[WpfFact]
public void DoWhile()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class C
{
void M()
@@ -3010,12 +2791,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoWhile2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class C
{
void M()
@@ -3029,12 +2808,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoWhile3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class C
{
void M()
@@ -3048,12 +2825,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoWhile4()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class C
{
void M()
@@ -3080,12 +2855,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/35260")]
public void DoWhile5()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class C
{
void M()
@@ -3112,12 +2885,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/35260")]
public void DoWhile6()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class C
{
void M()
@@ -3144,12 +2915,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoWhile_MissingParen()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
public class C
{
void M()
@@ -3176,12 +2945,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Break()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class C
{
void M()
@@ -3196,12 +2963,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Break2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class C
{
void M()
@@ -3216,12 +2981,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Break3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class C
{
void M()
@@ -3236,12 +2999,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Checked()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
static void Main(string[] args)
@@ -3265,12 +3026,10 @@ static void Main(string[] args)
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Unchecked()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
static void Main(string[] args)
@@ -3294,12 +3053,10 @@ static void Main(string[] args)
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Fixed()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
static void Main()
@@ -3321,12 +3078,10 @@ unsafe static string Transform()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Continue()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class ContinueTest
{
static void Main()
@@ -3342,12 +3097,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Continue2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class ContinueTest
{
static void Main()
@@ -3363,12 +3116,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Continue3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class ContinueTest
{
static void Main()
@@ -3384,12 +3135,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_GoTo()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
static void Main()
{
int n = 1;
@@ -3405,12 +3154,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_IfStatement()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
void M()
@@ -3423,12 +3170,10 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Labeled()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
static void Main()
@@ -3439,12 +3184,10 @@ static void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_IfStatement2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class Program
{
void M()
@@ -3457,7 +3200,6 @@ void M()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_ClassNameOfMethodInvocation1()
@@ -3631,21 +3373,17 @@ public void DoNotComplete_UnterminatedCharLiteral(string literal)
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34176")]
public void DoNotComplete_VerbatimStringAsMethodArgument_EndOfLine_NotEndOfString()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
var code = Foo(@"$$
") ;
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34176")]
public void DoNotComplete_VerbatimStringAsMethodArgument_EndOfString_NotEndOfLine()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
var code = Foo(@" $$" //comments
);
""");
- }
[WpfFact]
public void DoNotComplete_InterpolatedString()
@@ -3659,8 +3397,7 @@ public void DoNotComplete_InterpolatedString()
[WpfFact]
public void DoNotComplete_Attribute()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System;
class Program
@@ -3677,23 +3414,19 @@ static void Test()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Attribute2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
[assembly: System.Reflection.AssemblyVersionAttribute(null$$)]
class Program
{
}
""");
- }
[WpfFact]
public void DoNotComplete_Attribute3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System.Runtime.CompilerServices;
using System;
@@ -3712,12 +3445,10 @@ public void MyMethod() {
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Attribute4()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System;
using System.Reflection;
@@ -3740,12 +3471,10 @@ public static void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Attribute5()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System;
using System.Reflection;
@@ -3768,12 +3497,10 @@ public static void Main()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Attribute6()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System;
class Program
@@ -3790,37 +3517,29 @@ static void Test()
}
}
""");
- }
[WpfFact]
public void DoNotComplete_Using()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System.Linq$$
""");
- }
[WpfFact]
public void DoNotComplete_Using2()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System.Linq$$;
""");
- }
[WpfFact]
public void DoNotComplete_Using3()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
using System.$$Linq
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/33851")]
public void AtEndOfLineOutsideParens()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class Class1
{
void M()
@@ -3832,12 +3551,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/33851")]
public void OutsideParensBeforeSpaceDot()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class Class1
{
void M()
@@ -3848,12 +3565,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34666")]
public void BeforeAttribute()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
public class C
{
private const string s =
@@ -3865,12 +3580,10 @@ public void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34666")]
public void ElementBindingExpression()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
void M()
@@ -3889,12 +3602,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34666")]
public void BeforeElementBindingExpression()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
void M()
@@ -3904,12 +3615,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34666")]
public void AfterElementBindingExpression()
- {
- VerifyNoSpecialSemicolonHandling("""
+ => VerifyNoSpecialSemicolonHandling("""
class C
{
void M()
@@ -3919,13 +3628,11 @@ void M()
}
}
""");
- }
[WorkItem("https://github.com/dotnet/roslyn/issues/34666")]
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void ImplicitElementAccessSyntax()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
void M()
@@ -3948,12 +3655,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34666")]
public void BeforeImplicitElementAccessSyntax()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
void M()
@@ -3976,12 +3681,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34666")]
public void AfterImplicitElementAccessSyntax()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class C
{
void M()
@@ -4004,12 +3707,10 @@ void M()
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void AttributeParsedAsElementAccessExpression()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System;
internal class TestMethodAttribute : Attribute
{
@@ -4026,12 +3727,10 @@ internal class TestMethodAttribute : Attribute
[Test]
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void MemberAccessOffOfMethod()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class Program
{
static void Main(string[] args)
@@ -4050,12 +3749,10 @@ static void Main(string[] args)
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void LinqQuery()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System.Collections.Generic;
using System.Linq;
class Query
@@ -4084,12 +3781,10 @@ void Main(string[] args)
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void LinqQuery2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System.Collections.Generic;
using System.Linq;
class Query
@@ -4116,12 +3811,10 @@ void Main(string[] args)
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void BinaryExpression()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class D
{
void M()
@@ -4148,12 +3841,10 @@ private int Foo(int v)
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void BinaryExpression2()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class D
{
void M()
@@ -4180,12 +3871,10 @@ private int Foo(int v)
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void AsOperator()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class D
{
void M()
@@ -4212,12 +3901,10 @@ object Foo(int v)
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void TernaryOperator()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class Query
{
void Main(string[] args)
@@ -4246,12 +3933,10 @@ private int Foo(int j)
return j;
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/34983")]
public void SemicolonInCharacterLiteral()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
class D
{
void Main(string[]args)
@@ -4276,12 +3961,10 @@ void M(char c)
}
}
""");
- }
[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/35260")]
public void IncompleteLambda()
- {
- VerifyTypingSemicolon("""
+ => VerifyTypingSemicolon("""
using System;
class C
@@ -4312,7 +3995,6 @@ public void Test()
private void M(Func