private DynamicFileInfo CreateInfo(Key key, DocumentSnapshot document) { var filename = Path.ChangeExtension(key.FilePath, ".g.cs"); var textLoader = new GeneratedDocumentTextLoader(document, filename); return(new DynamicFileInfo(filename, SourceCodeKind.Regular, textLoader, _factory.Create(document))); }
public async Task LoadAsync_SpecifiesEncoding() { // Arrange var project = new DefaultProjectSnapshot( ProjectState.Create(Workspace.Services, HostProject) .WithAddedHostDocument(HostDocument, () => Task.FromResult(TextAndVersion.Create(SourceText.From(""), VersionStamp.Create())))); var document = project.GetDocument(HostDocument.FilePath); var loader = new GeneratedDocumentTextLoader(document, "file.cshtml"); // Act var textAndVersion = await loader.LoadTextAndVersionAsync(default, default, default);