| Name | Message | Date |
|---|---|---|
| 📄 IncludesProjectShould.cs | 6 days ago |
📄
core/tests/ScannerOptionsTests/IncludesProjectShould.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using Shouldly; using Xunit; namespace Cfa.Tests.ScannerOptionsTests; public sealed class IncludesProjectShould { [Theory] [InlineData("/repo/src/MyApp.csproj")] [InlineData("/repo/tests/MyApp.Tests.csproj")] public void IncludeEverythingWhenNoPatternsAreSpecified(string path) { // Arrange var options = new ScannerOptions(); // Act var result = options.IncludesProject(path); // Assert result.ShouldBeTrue(); } [Theory] [InlineData("/repo/tests/MyApp.Tests.csproj", false)] [InlineData(@"C:\repo\tests\MyApp.Tests.csproj", false)] [InlineData("/repo/Tests/MyApp.csproj", true)] public void MatchExclusionsAgainstTheProjectFilenameOnly(string path, bool expected) { // Arrange var options = new ScannerOptions { ExcludePatterns = [new("*Tests*")] }; // Act var result = options.IncludesProject(path); // Assert result.ShouldBe(expected); } [Theory] [InlineData("/repo/MyApp.csproj", true)] [InlineData("/repo/Other.csproj", true)] [InlineData("/repo/Unrelated.csproj", false)] [InlineData("/repo/MyApp.Tests.csproj", false)] [InlineData("/repo/MyApp.Specs.csproj", false)] public void AcceptAnyIncludeButLetExclusionsWin(string path, bool expected) { // Arrange var options = new ScannerOptions { IncludePatterns = [new("MyApp*"), new("Other*")], ExcludePatterns = [new("*Tests*"), new("*Specs*")], }; // Act var result = options.IncludesProject(path); // Assert result.ShouldBe(expected); } }