зеркало из https://github.com/dotnet/razor.git
Apply suggestions from code review feedback
This commit is contained in:
Родитель
46a0223de4
Коммит
c4b31c396d
|
@ -2,7 +2,7 @@
|
|||
<!-- Opt-in arcade features -->
|
||||
<PropertyGroup>
|
||||
<UsingToolVSSDK>true</UsingToolVSSDK>
|
||||
<MicrosoftVSSDKBuildToolsVersion>17.3.2094</MicrosoftVSSDKBuildToolsVersion>
|
||||
<MicrosoftVSSDKBuildToolsVersion>17.9.201-preview1-g58652eded2</MicrosoftVSSDKBuildToolsVersion>
|
||||
<MicroBuildPluginsSwixBuildVersion>1.1.33</MicroBuildPluginsSwixBuildVersion>
|
||||
<!-- Use .NET Framework reference assemblies from a nuget package so machine-global targeting packs do not need to be installed. -->
|
||||
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<Project>
|
||||
<!-- Only include .NET Framework files when building for .NET Framework -->
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
|
||||
<Compile Remove="**\*.NetFX.cs" />
|
||||
<Compile Remove="**\*.NetFx.cs" />
|
||||
<Compile Remove="**\NetFx\**\*.*" />
|
||||
<Compile Remove="**\*_NetFx\**\*.*" />
|
||||
|
||||
<None Include="**\*.NetFX.cs" />
|
||||
<None Include="**\*.NetFx.cs" />
|
||||
<None Include="**\NetFx\**\*.*" />
|
||||
<None Include="**\*_NetFx\**\*.*" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -224,10 +224,9 @@ public class ExtractToCodeBehindCodeActionProviderTest(ITestOutputHelper testOut
|
|||
Assert.NotNull(razorCodeActionResolutionParams);
|
||||
var actionParams = ((JObject)razorCodeActionResolutionParams.Data).ToObject<ExtractToCodeBehindCodeActionParams>();
|
||||
Assert.NotNull(actionParams);
|
||||
Assert.Equal(removeSpan.Start, actionParams.RemoveStart);
|
||||
Assert.Equal(extractSpan.Start, actionParams.ExtractStart);
|
||||
Assert.Equal(extractSpan.End, actionParams.ExtractEnd);
|
||||
Assert.Equal(removeSpan.End, actionParams.RemoveEnd);
|
||||
|
||||
Assert.Equal(removeSpan, TextSpan.FromBounds(actionParams.RemoveStart, actionParams.RemoveEnd));
|
||||
Assert.Equal(extractSpan, TextSpan.FromBounds(actionParams.ExtractStart, actionParams.ExtractEnd));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -270,10 +269,8 @@ public class ExtractToCodeBehindCodeActionProviderTest(ITestOutputHelper testOut
|
|||
var actionParams = ((JObject)razorCodeActionResolutionParams.Data).ToObject<ExtractToCodeBehindCodeActionParams>();
|
||||
Assert.NotNull(actionParams);
|
||||
|
||||
Assert.Equal(removeSpan.Start, actionParams.RemoveStart);
|
||||
Assert.Equal(extractSpan.Start, actionParams.ExtractStart);
|
||||
Assert.Equal(extractSpan.End, actionParams.ExtractEnd);
|
||||
Assert.Equal(removeSpan.End, actionParams.RemoveEnd);
|
||||
Assert.Equal(removeSpan, TextSpan.FromBounds(actionParams.RemoveStart, actionParams.RemoveEnd));
|
||||
Assert.Equal(extractSpan, TextSpan.FromBounds(actionParams.ExtractStart, actionParams.ExtractEnd));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -345,10 +342,9 @@ public class ExtractToCodeBehindCodeActionProviderTest(ITestOutputHelper testOut
|
|||
Assert.NotNull(razorCodeActionResolutionParams);
|
||||
var actionParams = ((JObject)razorCodeActionResolutionParams.Data).ToObject<ExtractToCodeBehindCodeActionParams>();
|
||||
Assert.NotNull(actionParams);
|
||||
Assert.Equal(removeSpan.Start, actionParams.RemoveStart);
|
||||
Assert.Equal(extractSpan.Start, actionParams.ExtractStart);
|
||||
Assert.Equal(extractSpan.End, actionParams.ExtractEnd);
|
||||
Assert.Equal(removeSpan.End, actionParams.RemoveEnd);
|
||||
|
||||
Assert.Equal(removeSpan, TextSpan.FromBounds(actionParams.RemoveStart, actionParams.RemoveEnd));
|
||||
Assert.Equal(extractSpan, TextSpan.FromBounds(actionParams.ExtractStart, actionParams.ExtractEnd));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Test;
|
|||
|
||||
public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
||||
{
|
||||
private static readonly string s_baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
|
||||
private readonly DocumentVersionCache _documentVersionCache;
|
||||
private readonly TestProjectSnapshotManager _projectSnapshotManagerBase;
|
||||
private readonly TestProjectSnapshotManagerAccessor _projectSnapshotManagerAccessor;
|
||||
|
@ -37,8 +39,7 @@ public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
|||
public void TryCreateAsync_CanNotResolveDocument_ReturnsNull()
|
||||
{
|
||||
// Arrange
|
||||
var baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(baseDirectory, "file.cshtml"));
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml"));
|
||||
var uri = new Uri(filePath);
|
||||
|
||||
var factory = new DefaultDocumentContextFactory(_projectSnapshotManagerAccessor, new TestDocumentResolver(), _documentVersionCache, LoggerFactory);
|
||||
|
@ -54,8 +55,7 @@ public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
|||
public void TryCreateForOpenDocumentAsync_CanNotResolveDocument_ReturnsNull()
|
||||
{
|
||||
// Arrange
|
||||
var baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(baseDirectory, "file.cshtml"));
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml"));
|
||||
var uri = new Uri(filePath);
|
||||
|
||||
var factory = new DefaultDocumentContextFactory(_projectSnapshotManagerAccessor, new TestDocumentResolver(), _documentVersionCache, LoggerFactory);
|
||||
|
@ -71,8 +71,7 @@ public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
|||
public void TryCreateForOpenDocumentAsync_CanNotResolveVersion_ReturnsNull()
|
||||
{
|
||||
// Arrange
|
||||
var baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(baseDirectory, "file.cshtml"));
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml"));
|
||||
var uri = new Uri(filePath);
|
||||
|
||||
var documentSnapshot = TestDocumentSnapshot.Create(filePath);
|
||||
|
@ -90,8 +89,7 @@ public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
|||
public void TryCreateAsync_ResolvesContent()
|
||||
{
|
||||
// Arrange
|
||||
var baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(baseDirectory, "file.cshtml"));
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml"));
|
||||
var uri = new Uri(filePath);
|
||||
|
||||
var documentSnapshot = TestDocumentSnapshot.Create(filePath);
|
||||
|
@ -113,10 +111,9 @@ public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
|||
public void TryCreateAsync_WithProjectContext_Resolves()
|
||||
{
|
||||
// Arrange
|
||||
var baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(baseDirectory, "file.cshtml"));
|
||||
var intermediateOutputPath = Path.Combine(baseDirectory, "obj");
|
||||
var projectFilePath = Path.Combine(baseDirectory, "project.csproj");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml"));
|
||||
var intermediateOutputPath = Path.Combine(s_baseDirectory, "obj");
|
||||
var projectFilePath = Path.Combine(s_baseDirectory, "project.csproj");
|
||||
var uri = new Uri(filePath);
|
||||
|
||||
var documentSnapshot = TestDocumentSnapshot.Create(filePath);
|
||||
|
@ -142,10 +139,9 @@ public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
|||
public void TryCreateAsync_WithProjectContext_DoesntUseSnapshotResolver()
|
||||
{
|
||||
// Arrange
|
||||
var baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(baseDirectory, "file.cshtml"));
|
||||
var intermediateOutputPath = Path.Combine(baseDirectory, "obj");
|
||||
var projectFilePath = Path.Combine(baseDirectory, "project.csproj");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml"));
|
||||
var intermediateOutputPath = Path.Combine(s_baseDirectory, "obj");
|
||||
var projectFilePath = Path.Combine(s_baseDirectory, "project.csproj");
|
||||
var uri = new Uri(filePath);
|
||||
|
||||
var documentSnapshot = TestDocumentSnapshot.Create(filePath);
|
||||
|
@ -172,8 +168,7 @@ public class DefaultDocumentContextFactoryTest : LanguageServerTestBase
|
|||
public async Task TryCreateForOpenDocumentAsync_ResolvesContent()
|
||||
{
|
||||
// Arrange
|
||||
var baseDirectory = PathUtilities.CreateRootedPath("path", "to");
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(baseDirectory, "file.cshtml"));
|
||||
var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml"));
|
||||
var uri = new Uri(filePath);
|
||||
|
||||
var documentSnapshot = TestDocumentSnapshot.Create(filePath);
|
||||
|
|
Загрузка…
Ссылка в новой задаче