public void GetDirectories_should_return_expected_results() { var fileResolver = new FileResolver(); var tempDir = Path.Combine(Path.GetTempPath(), $"BICEP_TESTDIR_{Guid.NewGuid()}"); var tempFile = Path.Combine(tempDir, $"BICEP_TEST_{Guid.NewGuid()}"); var tempChildDir = Path.Combine(tempDir, $"BICEP_TESTCHILDDIR_{Guid.NewGuid()}"); // make parent dir Directory.CreateDirectory(tempDir); fileResolver.GetDirectories(PathHelper.FilePathToFileUrl(tempDir)).Should().HaveCount(0); // make child dir Directory.CreateDirectory(tempChildDir); fileResolver.GetDirectories(PathHelper.FilePathToFileUrl(tempDir)).Should().HaveCount(1); // add a file to parent dir File.WriteAllText(tempFile, "abcd\r\ndef"); fileResolver.GetDirectories(PathHelper.FilePathToFileUrl(tempDir)).Should().HaveCount(1); // check child dir fileResolver.GetDirectories(PathHelper.FilePathToFileUrl(tempChildDir)).Should().HaveCount(0); // should throw an IOException when called with a file path fileResolver.GetDirectories(PathHelper.FilePathToFileUrl(Path.Join(Path.GetTempPath(), tempFile))); }