Esempio n. 1
0
        public static TestProjectSnapshot Create(string filePath, string[] documentFilePaths)
        {
            var workspace   = TestWorkspace.Create();
            var hostProject = new HostProject(filePath, RazorConfiguration.Default);
            var state       = ProjectState.Create(workspace.Services, hostProject);

            foreach (var documentFilePath in documentFilePaths)
            {
                var hostDocument = new HostDocument(documentFilePath, documentFilePath);
                state = state.WithAddedHostDocument(hostDocument, () => Task.FromResult(TextAndVersion.Create(SourceText.From(string.Empty), VersionStamp.Default)));
            }
            var testProject = new TestProjectSnapshot(state);

            return(testProject);
        }
Esempio n. 2
0
        public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version)
        {
            var testProject   = TestProjectSnapshot.Create(filePath + ".csproj");
            var testWorkspace = TestWorkspace.Create();
            var hostDocument  = new HostDocument(filePath, filePath);
            var sourceText    = SourceText.From(text);
            var documentState = new DocumentState(
                testWorkspace.Services,
                hostDocument,
                SourceText.From(text),
                version,
                () => Task.FromResult(TextAndVersion.Create(sourceText, version)));
            var testDocument = new TestDocumentSnapshot(testProject, documentState);

            return(testDocument);
        }