コード例 #1
0
 private static IEnumerable <DocumentInfo> GetDocuments(ProjectAnalyzer analyzer, ProjectId projectId) =>
 analyzer
 .GetSourceFiles()
 ?.Where(File.Exists)
 .Select(x => DocumentInfo.Create(
             DocumentId.CreateNewId(projectId),
             Path.GetFileName(x),
             loader: TextLoader.From(
                 TextAndVersion.Create(
                     SourceText.From(File.ReadAllText(x)), VersionStamp.Create())),
             filePath: x))
 ?? Array.Empty <DocumentInfo>();
コード例 #2
0
        public void GetsSourceFiles(string projectFile)
        {
            // Given
            StringBuilder   log      = new StringBuilder();
            ProjectAnalyzer analyzer = GetProjectAnalyzer(projectFile, log);

            // When
            IReadOnlyList <string> sourceFiles = analyzer.GetSourceFiles();

            // Then
            sourceFiles.ShouldContain(x => x.EndsWith("Class1.cs"));
        }