зеркало из https://github.com/dotnet/razor.git
Update tests and benchmark
This commit is contained in:
Родитель
9d02758cd2
Коммит
87c0163974
|
@ -4,6 +4,7 @@
|
|||
using System.Collections.Immutable;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.LanguageServer;
|
||||
using Microsoft.AspNetCore.Razor.PooledObjects;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.Razor.Logging;
|
||||
|
@ -53,6 +54,7 @@ public abstract partial class ProjectSnapshotManagerBenchmarkBase
|
|||
{
|
||||
return new ProjectSnapshotManager(
|
||||
projectEngineFactoryProvider: StaticProjectEngineFactoryProvider.Instance,
|
||||
languageServerFeatureOptions: new DefaultLanguageServerFeatureOptions(),
|
||||
loggerFactory: EmptyLoggerFactory.Instance);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Collections.Immutable;
|
|||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.ProjectSystem;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
|
||||
using Microsoft.CodeAnalysis.Razor;
|
||||
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
|
||||
using Xunit;
|
||||
|
@ -49,12 +50,12 @@ public class ProjectEngineFactoryProviderTest : ToolingTestBase
|
|||
projectFilePath, intermediateOutputPath,
|
||||
new(RazorLanguageVersion.Version_2_1, "Random-0.1", Extensions: []), rootNamespace: null);
|
||||
|
||||
_snapshot_For_1_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_1_0, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_1_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_1_1, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_2_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_2_0, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_2_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_2_1, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_3_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_3_0, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_UnknownConfiguration = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_UnknownConfiguration, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_1_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_1_0, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_1_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_1_1, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_2_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_2_0, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_2_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_2_1, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_3_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_3_0, ProjectWorkspaceState.Default));
|
||||
_snapshot_For_UnknownConfiguration = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_UnknownConfiguration, ProjectWorkspaceState.Default));
|
||||
|
||||
_customFactories =
|
||||
[
|
||||
|
|
|
@ -49,9 +49,10 @@ public abstract class LanguageServerTestBase : ToolingTestBase
|
|||
}
|
||||
|
||||
private protected override TestProjectSnapshotManager CreateProjectSnapshotManager(
|
||||
IProjectEngineFactoryProvider projectEngineFactoryProvider)
|
||||
IProjectEngineFactoryProvider projectEngineFactoryProvider, LanguageServerFeatureOptions languageServerFeatureOptions)
|
||||
=> new(
|
||||
projectEngineFactoryProvider,
|
||||
languageServerFeatureOptions,
|
||||
LoggerFactory,
|
||||
DisposalToken,
|
||||
initializer: static updater => updater.ProjectAdded(MiscFilesHostProject.Instance));
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.ProjectEngineHost;
|
||||
using Microsoft.AspNetCore.Razor.ProjectSystem;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
|
||||
|
@ -30,7 +31,7 @@ internal sealed class TestProjectSnapshot : IProjectSnapshot
|
|||
var hostProject = TestHostProject.Create(filePath);
|
||||
projectWorkspaceState ??= ProjectWorkspaceState.Default;
|
||||
|
||||
var state = ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject, projectWorkspaceState);
|
||||
var state = ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject, projectWorkspaceState);
|
||||
|
||||
return new TestProjectSnapshot(state);
|
||||
}
|
||||
|
|
|
@ -7,15 +7,17 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNetCore.Razor.ProjectEngineHost;
|
||||
using Microsoft.CodeAnalysis.Razor.Logging;
|
||||
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
|
||||
using Microsoft.CodeAnalysis.Razor.Workspaces;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem;
|
||||
|
||||
internal partial class TestProjectSnapshotManager(
|
||||
IProjectEngineFactoryProvider projectEngineFactoryProvider,
|
||||
LanguageServerFeatureOptions languageServerFeatureOptions,
|
||||
ILoggerFactory loggerFactory,
|
||||
CancellationToken disposalToken,
|
||||
Action<ProjectSnapshotManager.Updater>? initializer = null)
|
||||
: ProjectSnapshotManager(projectEngineFactoryProvider, loggerFactory, initializer)
|
||||
: ProjectSnapshotManager(projectEngineFactoryProvider, languageServerFeatureOptions, loggerFactory, initializer)
|
||||
{
|
||||
private readonly CancellationToken _disposalToken = disposalToken;
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNetCore.Razor.ProjectEngineHost;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.Logging;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
|
||||
using Microsoft.CodeAnalysis.Razor.Logging;
|
||||
using Microsoft.CodeAnalysis.Razor.Workspaces;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
@ -221,8 +223,12 @@ public abstract partial class ToolingTestBase : IAsyncLifetime
|
|||
=> CreateProjectSnapshotManager(ProjectEngineFactories.DefaultProvider);
|
||||
|
||||
private protected virtual TestProjectSnapshotManager CreateProjectSnapshotManager(IProjectEngineFactoryProvider projectEngineFactoryProvider)
|
||||
=> CreateProjectSnapshotManager(projectEngineFactoryProvider, TestLanguageServerFeatureOptions.Instance);
|
||||
|
||||
private protected virtual TestProjectSnapshotManager CreateProjectSnapshotManager(IProjectEngineFactoryProvider projectEngineFactoryProvider, LanguageServerFeatureOptions languageServerFeatureOptions)
|
||||
=> new(
|
||||
projectEngineFactoryProvider,
|
||||
languageServerFeatureOptions,
|
||||
LoggerFactory,
|
||||
DisposalToken);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public abstract class DocumentExcerptServiceTestBase(ITestOutputHelper testOutpu
|
|||
private (IDocumentSnapshot primary, Document secondary) InitializeDocument(SourceText sourceText)
|
||||
{
|
||||
var state = ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create()));
|
||||
|
||||
var project = new ProjectSnapshot(state);
|
||||
|
|
|
@ -20,6 +20,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT
|
|||
private Workspace? _workspace;
|
||||
private IWorkspaceProvider? _workspaceProvider;
|
||||
private IProjectEngineFactoryProvider? _projectEngineFactoryProvider;
|
||||
private LanguageServerFeatureOptions? _languageServerFeatureOptions;
|
||||
|
||||
protected HostServices HostServices
|
||||
{
|
||||
|
@ -57,8 +58,20 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT
|
|||
}
|
||||
}
|
||||
|
||||
private protected LanguageServerFeatureOptions LanguageServerFeatureOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureInitialized();
|
||||
return _languageServerFeatureOptions;
|
||||
}
|
||||
}
|
||||
|
||||
private protected override TestProjectSnapshotManager CreateProjectSnapshotManager()
|
||||
=> CreateProjectSnapshotManager(ProjectEngineFactoryProvider);
|
||||
=> CreateProjectSnapshotManager(ProjectEngineFactoryProvider, LanguageServerFeatureOptions);
|
||||
|
||||
private protected override TestProjectSnapshotManager CreateProjectSnapshotManager(IProjectEngineFactoryProvider projectEngineFactoryProvider)
|
||||
=> base.CreateProjectSnapshotManager(projectEngineFactoryProvider, LanguageServerFeatureOptions);
|
||||
|
||||
protected virtual void ConfigureWorkspace(AdhocWorkspace workspace)
|
||||
{
|
||||
|
@ -68,7 +81,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT
|
|||
{
|
||||
}
|
||||
|
||||
[MemberNotNull(nameof(_hostServices), nameof(_workspace), nameof(_workspaceProvider), nameof(_projectEngineFactoryProvider))]
|
||||
[MemberNotNull(nameof(_hostServices), nameof(_workspace), nameof(_workspaceProvider), nameof(_projectEngineFactoryProvider), nameof(_languageServerFeatureOptions))]
|
||||
private void EnsureInitialized()
|
||||
{
|
||||
if (_initialized)
|
||||
|
@ -77,6 +90,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT
|
|||
_workspace.AssumeNotNull();
|
||||
_workspaceProvider.AssumeNotNull();
|
||||
_projectEngineFactoryProvider.AssumeNotNull();
|
||||
_languageServerFeatureOptions.AssumeNotNull();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -89,6 +103,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT
|
|||
_workspace = TestWorkspace.Create(_hostServices, ConfigureWorkspace);
|
||||
AddDisposable(_workspace);
|
||||
_workspaceProvider = new TestWorkspaceProvider(_workspace);
|
||||
_languageServerFeatureOptions = TestLanguageServerFeatureOptions.Instance;
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class DefaultDocumentSnapshotTest : WorkspaceTestBase
|
|||
_sourceText = SourceText.From("<p>Hello World</p>");
|
||||
_version = VersionStamp.Create();
|
||||
|
||||
var projectState = ProjectState.Create(ProjectEngineFactoryProvider, TestProjectData.SomeProject, ProjectWorkspaceState.Default);
|
||||
var projectState = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, TestProjectData.SomeProject, ProjectWorkspaceState.Default);
|
||||
var project = new ProjectSnapshot(projectState);
|
||||
|
||||
var textLoader = TestMocks.CreateTextLoader(_sourceText, _version);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class DefaultProjectSnapshotTest : WorkspaceTestBase
|
|||
public void ProjectSnapshot_CachesDocumentSnapshots()
|
||||
{
|
||||
// Arrange
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader);
|
||||
|
@ -65,7 +65,7 @@ public class DefaultProjectSnapshotTest : WorkspaceTestBase
|
|||
public void GetRelatedDocuments_NonImportDocument_ReturnsEmpty()
|
||||
{
|
||||
// Arrange
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader);
|
||||
var snapshot = new ProjectSnapshot(state);
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class DefaultProjectSnapshotTest : WorkspaceTestBase
|
|||
public void GetRelatedDocuments_ImportDocument_ReturnsRelated()
|
||||
{
|
||||
// Arrange
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class GeneratedDocumentTextLoaderTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var project = new ProjectSnapshot(
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader("", VersionStamp.Create())));
|
||||
|
||||
var document = project.GetDocument(_hostDocument.FilePath);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original =
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader);
|
||||
|
||||
var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken);
|
||||
|
@ -62,7 +62,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original =
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader);
|
||||
|
||||
var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken);
|
||||
|
@ -82,7 +82,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original = ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original = ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original =
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -147,7 +147,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original =
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader);
|
||||
|
||||
var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken);
|
||||
|
@ -168,7 +168,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original =
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader);
|
||||
|
||||
var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken);
|
||||
|
@ -192,7 +192,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
var hostProject = TestProjectData.SomeProject with { Configuration = csharp8ValidConfiguration };
|
||||
var originalWorkspaceState = ProjectWorkspaceState.Create(_someTagHelpers, LanguageVersion.CSharp7);
|
||||
var original =
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, hostProject, originalWorkspaceState)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, hostProject, originalWorkspaceState)
|
||||
.WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader("@DateTime.Now", VersionStamp.Default));
|
||||
var changedWorkspaceState = ProjectWorkspaceState.Create(_someTagHelpers, LanguageVersion.CSharp8);
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var original =
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader);
|
||||
|
||||
var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void GetImportDocumentTargetPaths_DoesNotIncludeCurrentImport()
|
||||
{
|
||||
// Arrange
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
|
||||
// Act
|
||||
var paths = state.GetImportDocumentTargetPaths(TestProjectData.SomeProjectComponentImportFile1);
|
||||
|
@ -71,7 +71,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
// Arrange
|
||||
|
||||
// Act
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
|
||||
// Assert
|
||||
Assert.Empty(state.Documents);
|
||||
|
@ -82,7 +82,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_AddHostDocument_ToEmpty()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
|
||||
// Act
|
||||
var state = original.WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader);
|
||||
|
@ -100,7 +100,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public async Task ProjectState_AddHostDocument_DocumentIsEmpty()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
|
||||
// Act
|
||||
var state = original.WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader);
|
||||
|
@ -114,7 +114,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_AddHostDocument_ToProjectWithDocuments()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
// Arrange
|
||||
|
||||
// Act
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader)
|
||||
|
@ -177,7 +177,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_AddHostDocument_TracksImports_AddImportFile()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader)
|
||||
|
@ -220,7 +220,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_AddHostDocument_RetainsComputedState()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -253,7 +253,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_AddHostDocument_DuplicateNoops()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -268,7 +268,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public async Task ProjectState_WithChangedHostDocument_Loader()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -288,7 +288,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public async Task ProjectState_WithChangedHostDocument_Snapshot()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -308,7 +308,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithChangedHostDocument_Loader_RetainsComputedState()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -340,7 +340,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithChangedHostDocument_Snapshot_RetainsComputedState()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -372,7 +372,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithChangedHostDocument_Loader_NotFoundNoops()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -387,7 +387,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithChangedHostDocument_Snapshot_NotFoundNoops()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -402,7 +402,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_RemoveHostDocument_FromProjectWithDocuments()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -423,7 +423,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_RemoveHostDocument_TracksImports()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader)
|
||||
|
@ -463,7 +463,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_RemoveHostDocument_TracksImports_RemoveAllDocuments()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader)
|
||||
|
@ -485,7 +485,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_RemoveHostDocument_RetainsComputedState()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -517,7 +517,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_RemoveHostDocument_NotFoundNoops()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -532,7 +532,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithHostProject_ConfigurationChange_UpdatesConfigurationState()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -570,7 +570,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithHostProject_RootNamespaceChange_UpdatesConfigurationState()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
var hostProjectWithRootNamespaceChange = original.HostProject with { RootNamespace = "ChangedRootNamespace" };
|
||||
|
@ -590,7 +590,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithHostProject_NoConfigurationChange_Noops()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -614,7 +614,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
documents[_documents[1].FilePath] = TestDocumentState.Create(_documents[1], onConfigurationChange: () => callCount++);
|
||||
documents[_documents[2].FilePath] = TestDocumentState.Create(_documents[2], onConfigurationChange: () => callCount++);
|
||||
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original.Documents = documents.ToImmutable();
|
||||
|
||||
// Act
|
||||
|
@ -630,7 +630,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithHostProject_ResetsImportedDocuments()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original = original.WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader);
|
||||
|
||||
// Act
|
||||
|
@ -646,7 +646,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithProjectWorkspaceState_Changed()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -685,7 +685,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithProjectWorkspaceState_Changed_TagHelpersChanged()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -719,7 +719,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
public void ProjectState_WithProjectWorkspaceState_IdenticalState_Caches()
|
||||
{
|
||||
// Arrange
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState)
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState)
|
||||
.WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader)
|
||||
.WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader);
|
||||
|
||||
|
@ -746,7 +746,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
documents[_documents[1].FilePath] = TestDocumentState.Create(_documents[1], onProjectWorkspaceStateChange: () => callCount++);
|
||||
documents[_documents[2].FilePath] = TestDocumentState.Create(_documents[2], onProjectWorkspaceStateChange: () => callCount++);
|
||||
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original.Documents = documents.ToImmutable();
|
||||
|
||||
var changed = ProjectWorkspaceState.Default;
|
||||
|
@ -790,7 +790,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
TestProjectData.SomeProjectNestedFile3.FilePath,
|
||||
TestProjectData.AnotherProjectNestedFile4.FilePath));
|
||||
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original.Documents = documents.ToImmutable();
|
||||
original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable();
|
||||
|
||||
|
@ -833,7 +833,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
TestProjectData.SomeProjectNestedFile3.FilePath,
|
||||
TestProjectData.AnotherProjectNestedFile4.FilePath));
|
||||
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original.Documents = documents.ToImmutable();
|
||||
original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable();
|
||||
|
||||
|
@ -879,7 +879,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
TestProjectData.SomeProjectNestedFile3.FilePath,
|
||||
TestProjectData.AnotherProjectNestedFile4.FilePath));
|
||||
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original.Documents = documents.ToImmutable();
|
||||
original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable();
|
||||
|
||||
|
@ -925,7 +925,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
TestProjectData.SomeProjectNestedFile3.FilePath,
|
||||
TestProjectData.AnotherProjectNestedFile4.FilePath));
|
||||
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original.Documents = documents.ToImmutable();
|
||||
original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable();
|
||||
|
||||
|
@ -971,7 +971,7 @@ public class ProjectStateTest : WorkspaceTestBase
|
|||
TestProjectData.SomeProjectNestedFile3.FilePath,
|
||||
TestProjectData.AnotherProjectNestedFile4.FilePath));
|
||||
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState);
|
||||
var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState);
|
||||
original.Documents = documents.ToImmutable();
|
||||
original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa
|
|||
");
|
||||
|
||||
var project = new ProjectSnapshot(ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create())));
|
||||
|
||||
var document = project.GetDocument(_hostDocument.FilePath);
|
||||
|
@ -62,7 +62,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa
|
|||
");
|
||||
|
||||
var project = new ProjectSnapshot(ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create())));
|
||||
|
||||
var document = project.GetDocument(_hostDocument.FilePath);
|
||||
|
@ -95,7 +95,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa
|
|||
");
|
||||
|
||||
var project = new ProjectSnapshot(ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create())));
|
||||
|
||||
var document = project.GetDocument(_hostDocument.FilePath);
|
||||
|
@ -127,7 +127,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa
|
|||
");
|
||||
|
||||
var project = new ProjectSnapshot(ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create())));
|
||||
|
||||
var document = project.GetDocument(_hostDocument.FilePath);
|
||||
|
|
|
@ -97,7 +97,7 @@ public class RazorDocumentOptionsServiceTest(ITestOutputHelper testOutput) : Wor
|
|||
Path.Combine(baseDirectory, "SomeProject", "File1.cshtml"), "File1.cshtml", FileKinds.Legacy);
|
||||
|
||||
var project = new ProjectSnapshot(ProjectState
|
||||
.Create(ProjectEngineFactoryProvider, hostProject, ProjectWorkspaceState.Default)
|
||||
.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, hostProject, ProjectWorkspaceState.Default)
|
||||
.WithAddedHostDocument(hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create())));
|
||||
|
||||
var documentSnapshot = project.GetDocument(hostDocument.FilePath);
|
||||
|
|
|
@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Razor.Language;
|
|||
using Microsoft.AspNetCore.Razor.Test.Common;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.VisualStudio;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
|
||||
using Microsoft.VisualStudio.ProjectSystem.Properties;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
@ -451,7 +450,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
var projectState = new Dictionary<string, IProjectRuleSnapshot>().ToImmutableDictionary();
|
||||
|
||||
// Act
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration);
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
|
@ -473,7 +472,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
}.ToImmutableDictionary();
|
||||
|
||||
// Act
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration);
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
|
@ -496,7 +495,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
}.ToImmutableDictionary();
|
||||
|
||||
// Act
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration);
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
|
@ -525,7 +524,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
}.ToImmutableDictionary();
|
||||
|
||||
// Act
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration);
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
|
@ -559,7 +558,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
}.ToImmutableDictionary();
|
||||
|
||||
// Act
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration);
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
|
@ -607,7 +606,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
}.ToImmutableDictionary();
|
||||
|
||||
// Act
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration);
|
||||
var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
|
@ -624,7 +623,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
|
||||
// Act & Assert
|
||||
await host.LoadAsync();
|
||||
|
@ -639,7 +638,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
{
|
||||
// Arrange
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
|
||||
// Act & Assert
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -658,7 +657,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
};
|
||||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
|
||||
// Act & Assert
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -702,7 +701,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
host.SkipIntermediateOutputPathExistCheck_TestOnly = true;
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -755,7 +754,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
public void IntermediateOutputPathCalculationHandlesRelativePaths(string baseIntermediateOutputPath, string intermediateOutputPath, string expectedCombinedIOP)
|
||||
{
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
|
||||
var state = TestProjectRuleSnapshot.CreateProperties(
|
||||
WindowsRazorProjectHostBase.ConfigurationGeneralSchemaName,
|
||||
|
@ -798,7 +797,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
};
|
||||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
Assert.Empty(_projectManager.GetProjects());
|
||||
|
@ -849,7 +848,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
};
|
||||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
host.SkipIntermediateOutputPathExistCheck_TestOnly = true;
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -903,7 +902,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
};
|
||||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
host.SkipIntermediateOutputPathExistCheck_TestOnly = true;
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -1059,7 +1058,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
};
|
||||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
host.SkipIntermediateOutputPathExistCheck_TestOnly = true;
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -1134,7 +1133,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
};
|
||||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
host.SkipIntermediateOutputPathExistCheck_TestOnly = true;
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -1214,7 +1213,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
host.SkipIntermediateOutputPathExistCheck_TestOnly = true;
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
@ -1311,7 +1310,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase
|
|||
};
|
||||
|
||||
var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath);
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions());
|
||||
var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager);
|
||||
host.SkipIntermediateOutputPathExistCheck_TestOnly = true;
|
||||
|
||||
await Task.Run(async () => await host.LoadAsync());
|
||||
|
|
|
@ -39,7 +39,6 @@ public class FallbackProjectManagerTest : VisualStudioWorkspaceTestBase
|
|||
|
||||
_fallbackProjectManger = new FallbackProjectManager(
|
||||
serviceProvider,
|
||||
languageServerFeatureOptions,
|
||||
_projectManager,
|
||||
WorkspaceProvider,
|
||||
NoOpTelemetryReporter.Instance);
|
||||
|
|
|
@ -73,7 +73,6 @@ public class RazorDynamicFileInfoProviderTest(ITestOutputHelper testOutput) : Vi
|
|||
|
||||
var fallbackProjectManager = new FallbackProjectManager(
|
||||
serviceProvider,
|
||||
languageServerFeatureOptions,
|
||||
_projectManager,
|
||||
WorkspaceProvider,
|
||||
NoOpTelemetryReporter.Instance);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ProjectWorkspaceStateGeneratorTest : VisualStudioWorkspaceTestBase
|
|||
TestProjectData.SomeProject.FilePath));
|
||||
_workspaceProject = solution.GetProject(projectId).AssumeNotNull();
|
||||
_projectSnapshot = new ProjectSnapshot(
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, TestProjectData.SomeProject, ProjectWorkspaceState.Default));
|
||||
ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, TestProjectData.SomeProject, ProjectWorkspaceState.Default));
|
||||
_projectWorkspaceStateWithTagHelpers = ProjectWorkspaceState.Create(
|
||||
[TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly").Build()]);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче