Skip to content

Commit

Permalink
File enumeration not always deterministic on all OSs
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-martinsmith committed Aug 21, 2024
1 parent c13dc93 commit 52dfaaf
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions tests/DNX.Extensions.Tests/IO/DirectoryInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void FindFiles_for_single_pattern_without_recursion_finds_expected_files(
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(1);
result.First().Name.Should().Be("file.txt");
result.Count(x => x.Name == "file.txt").Should().Be(1);
}

[Fact]
Expand All @@ -91,9 +91,9 @@ public void FindFiles_for_single_pattern_with_recursion_finds_expected_files()
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(3);
result.First().Name.Should().Be("file.txt");
result.Skip(1).First().Name.Should().Be("file1.txt");
result.Skip(2).First().Name.Should().Be("file2.txt");
result.Count(x => x.Name == "file.txt").Should().Be(1);
result.Count(x => x.Name == "file1.txt").Should().Be(1);
result.Count(x => x.Name == "file2.txt").Should().Be(1);
}

[Fact]
Expand All @@ -109,8 +109,8 @@ public void FindFiles_for_multiple_patterns_without_recursion_finds_expected_fil
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(2);
result.First().Name.Should().Be("file.txt");
result.Skip(1).First().Name.Should().Be("file.json");
result.Count(x => x.Name == "file.txt").Should().Be(1);
result.Count(x => x.Name == "file.json").Should().Be(1);
}

[Fact]
Expand All @@ -126,12 +126,12 @@ public void FindFiles_for_multiple_patterns_with_recursion_finds_expected_files(
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(6);
result.First().Name.Should().Be("file.txt");
result.Skip(1).First().Name.Should().Be("file1.txt");
result.Skip(2).First().Name.Should().Be("file2.txt");
result.Skip(3).First().Name.Should().Be("file.json");
result.Skip(4).First().Name.Should().Be("file1.json");
result.Skip(5).First().Name.Should().Be("file2.json");
result.Count(x => x.Name == "file.txt").Should().Be(1);
result.Count(x => x.Name == "file1.txt").Should().Be(1);
result.Count(x => x.Name == "file2.txt").Should().Be(1);
result.Count(x => x.Name == "file.json").Should().Be(1);
result.Count(x => x.Name == "file1.json").Should().Be(1);
result.Count(x => x.Name == "file2.json").Should().Be(1);
}

[Fact]
Expand Down Expand Up @@ -161,8 +161,8 @@ public void FindDirectories_for_single_pattern_without_recursion_finds_expected_
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(2);
result.First().Name.Should().Be("dir1");
result.Skip(1).First().Name.Should().Be("dir2");
result.Count(x => x.Name == "dir1").Should().Be(1);
result.Count(x => x.Name == "dir2").Should().Be(1);
}

[Fact]
Expand All @@ -177,10 +177,10 @@ public void FindDirectories_for_single_pattern_with_recursion_finds_expected_fil
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(4);
result.First().Name.Should().Be("dir1");
result.Skip(1).First().Name.Should().Be("dir2");
result.Skip(2).First().Name.Should().Be("dur3");
result.Skip(3).First().Name.Should().Be("dur4");
result.Count(x => x.Name == "dir1").Should().Be(1);
result.Count(x => x.Name == "dir2").Should().Be(1);
result.Count(x => x.Name == "dur3").Should().Be(1);
result.Count(x => x.Name == "dur4").Should().Be(1);
}

[Fact]
Expand All @@ -195,8 +195,8 @@ public void FindDirectories_for_multiple_patterns_without_recursion_finds_expect
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(2);
result.First().Name.Should().Be("dir1");
result.Skip(1).First().Name.Should().Be("dir2");
result.Count(x => x.Name == "dir1").Should().Be(1);
result.Count(x => x.Name == "dir2").Should().Be(1);
}

[Fact]
Expand All @@ -211,10 +211,10 @@ public void FindDirectories_for_multiple_patterns_with_recursion_finds_expected_
// Assert
result.Should().NotBeNull();
result.Count().Should().Be(4);
result.First().Name.Should().Be("dir1");
result.Skip(1).First().Name.Should().Be("dir2");
result.Skip(2).First().Name.Should().Be("dur3");
result.Skip(3).First().Name.Should().Be("dur4");
result.Count(x => x.Name == "dir1").Should().Be(1);
result.Count(x => x.Name == "dir2").Should().Be(1);
result.Count(x => x.Name == "dur3").Should().Be(1);
result.Count(x => x.Name == "dur4").Should().Be(1);
}

[Theory]
Expand Down

0 comments on commit 52dfaaf

Please sign in to comment.