public void FastRecursiveDirectoryListing() { using (var a = TemporaryFile.CreateDirectory(Path.Combine(Path.GetTempPath(), "a"))) using (var aa = TemporaryFile.CreateDirectory(Path.Combine(a.Path, "aa"))) using (var ab = TemporaryFile.CreateDirectory(Path.Combine(a.Path, "ab"))) using (var aaa = TemporaryFile.CreateDirectory(Path.Combine(aa.Path, "aaa"))) { var directories = DirectorySearcher.GetDirectoriesFast(a.Path); Assert.That(directories.Select(dir => dir.FullName), Is.EquivalentTo(new[] { ab.Path, aaa.Path })); } }
public async Task ErrorEnumerationWithResolvedPath() { using (var git = TemporaryFile.CreateDirectory(Path.Combine(Path.GetTempPath(), "git"))) using (var proja = TemporaryFile.CreateDirectory(Path.Combine(git.Path, "proj-a"))) using (var src = TemporaryFile.CreateDirectory(Path.Combine(proja.Path, "src"))) using (var a = TemporaryFile.CreateFile(Path.Combine(src.Path, "a.cpp"))) using (var b = TemporaryFile.CreateFile(Path.Combine(src.Path, "b.cpp"))) { var errors = await Provider.GetErrorsAsync("A", git.Path); var expected = new List <ErrorListItem>() { new ErrorListItem() { ProjectName = "", FileName = a.Path, Line = 181, Message = "This expression casts between two pointer types.", ErrorCode = "QACPP3030", ErrorCodeToolTip = "Get help for 'QACPP3030'", ErrorCategory = "Vulnerability", Severity = __VSERRORCATEGORY.EC_MESSAGE }, new ErrorListItem() { ProjectName = "", FileName = b.Path, Line = 58, Message = "This operation is redundant. The value of the result is always that of the left-hand operand.", ErrorCode = "QACPP2985", ErrorCodeToolTip = "Get help for 'QACPP2985'", ErrorCategory = "Minor Bug", Severity = __VSERRORCATEGORY.EC_ERROR } }; Assert.That(errors, Is.EqualTo(expected).Using(new ErrorListItemComparer())); } }