Skip to content

Commit eb9a075

Browse files
Fix Windows-specific file paths in RemoteRazorProjectFileSystemTest
1 parent 4a41249 commit eb9a075

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RemoteRazorProjectFileSystemTest.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#nullable disable
55

6+
using System.IO;
7+
using System.Runtime.InteropServices;
68
using Microsoft.AspNetCore.Razor.Test.Common;
79
using Xunit;
810
using Xunit.Abstractions;
@@ -50,8 +52,19 @@ public void GetItem_RootedFilePath_BelongsToProject()
5052
public void GetItem_RootedFilePath_DoesNotBelongToProject()
5153
{
5254
// Arrange
53-
var fileSystem = new RemoteRazorProjectFileSystem("C:/path/to");
54-
var documentFilePath = "C:/otherpath/to/file.cshtml";
55+
RemoteRazorProjectFileSystem fileSystem;
56+
string documentFilePath;
57+
58+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
59+
{
60+
fileSystem = new RemoteRazorProjectFileSystem(@"C:\path\to");
61+
documentFilePath = @"C:\otherpath\to\file.cshtml";
62+
}
63+
else
64+
{
65+
fileSystem = new RemoteRazorProjectFileSystem("/path/to");
66+
documentFilePath = "/otherpath/to/file.cshtml";
67+
}
5568

5669
// Act
5770
var item = fileSystem.GetItem(documentFilePath, fileKind: null);

0 commit comments

Comments
 (0)