Skip to content

Commit 24f277c

Browse files
Fix Windows-specific file paths in DefaultDocumentContextFactoryTest
1 parent df013a0 commit 24f277c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System;
77
using System.Collections.Generic;
88
using System.Diagnostics.CodeAnalysis;
9+
using System.IO;
910
using System.Threading.Tasks;
1011
using Microsoft.AspNetCore.Razor.Language;
1112
using Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem;
@@ -108,7 +109,9 @@ public void TryCreateAsync_WithProjectContext_Resolves()
108109
var documentResolver = new TestDocumentResolver(documentSnapshot);
109110
var factory = new DefaultDocumentContextFactory(_projectSnapshotManagerAccessor, documentResolver, _documentVersionCache, LoggerFactory);
110111

111-
var hostProject = new HostProject(@"C:\goo", @"C:\goo\obj", RazorConfiguration.Default, rootNamespace: null);
112+
var projectFilePath = Path.Combine("C:", "goo");
113+
var intermediateOutputPath = Path.Combine(projectFilePath, "obj");
114+
var hostProject = new HostProject(projectFilePath, intermediateOutputPath, RazorConfiguration.Default, rootNamespace: null);
112115
_projectSnapshotManagerBase.ProjectAdded(hostProject);
113116
var hostDocument = new HostDocument(uri.GetAbsoluteOrUNCPath(), "file.cshtml");
114117
_projectSnapshotManagerBase.DocumentAdded(hostProject.Key, hostDocument, new EmptyTextLoader(uri.GetAbsoluteOrUNCPath()));
@@ -132,7 +135,9 @@ public void TryCreateAsync_WithProjectContext_DoesntUseSnapshotResolver()
132135
var documentResolverMock = new Mock<ISnapshotResolver>(MockBehavior.Strict);
133136
var factory = new DefaultDocumentContextFactory(_projectSnapshotManagerAccessor, documentResolverMock.Object, _documentVersionCache, LoggerFactory);
134137

135-
var hostProject = new HostProject(@"C:\goo", @"C:\goo\obj", RazorConfiguration.Default, rootNamespace: null);
138+
var projectFilePath = Path.Combine("C:", "goo");
139+
var intermediateOutputPath = Path.Combine(projectFilePath, "obj");
140+
var hostProject = new HostProject(projectFilePath, intermediateOutputPath, RazorConfiguration.Default, rootNamespace: null);
136141
_projectSnapshotManagerBase.ProjectAdded(hostProject);
137142
var hostDocument = new HostDocument(uri.GetAbsoluteOrUNCPath(), "file.cshtml");
138143
_projectSnapshotManagerBase.DocumentAdded(hostProject.Key, hostDocument, new EmptyTextLoader(uri.GetAbsoluteOrUNCPath()));

0 commit comments

Comments
 (0)