Skip to content

Add partial branch coverage#94

Merged
Bertk merged 2 commits into
mainfrom
update-issue-1969
Jul 3, 2026
Merged

Add partial branch coverage#94
Bertk merged 2 commits into
mainfrom
update-issue-1969

Conversation

@Bertk

@Bertk Bertk commented Jul 2, 2026

Copy link
Copy Markdown
Owner

This pull request adds new utility classes and corresponding tests to improve and extend the pattern matching and logical operator checks for string values "hello" and "world". The main focus is on providing additional variants for checking string equality using both operators and pattern matching, as well as ensuring these behaviors are properly tested.

New utility classes for string checks

  • Added IsOrPartial and IsOrWithout static classes to Issue1969.cs, each providing both an Operator method (using == and ||) and a PatternMatching method (using is with or) for checking if a string is "hello" or "world".

Test coverage improvements

  • Added OrPartialTest to verify that both operator and pattern matching methods in IsOrPartial correctly return true for "world".
  • Added OrWithoutTest to verify that both operator and pattern matching methods in IsOrWithout correctly return false for "other".

Copilot AI review requested due to automatic review settings July 2, 2026 12:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new “partial branch coverage” scenario for Issue1969 by introducing a second implementation (IsOrPartial) and a corresponding test that intentionally exercises only a subset of the logical branches.

Changes:

  • Add IsOrPartial static class alongside existing IsOr implementation.
  • Add OrPartialTest that runs only the "world" case to produce partial branch coverage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/BranchIssues.Tests/Issue1969Tests.cs Adds a new test intended to cover only part of the branches.
src/BranchIssues/Issue1969.cs Adds a new IsOrPartial implementation mirroring IsOr for partial coverage validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/BranchIssues.Tests/Issue1969Tests.cs
Added the IsOrWithout static class with Operator and PatternMatching methods to check for "hello" or "world". Introduced OrWithoutTest to verify both methods return false for non-matching input.
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Summary

Generated on: 7/3/2026 - 12:33:27 PM
Coverage date: 7/3/2026 - 12:33:00 PM - 7/3/2026 - 12:33:25 PM
Parser: MultiReport (9x Cobertura)
Assemblies: 8
Classes: 38
Files: 29
Line coverage: 86.9% (361 of 415)
Covered lines: 361
Uncovered lines: 54
Coverable lines: 415
Total lines: 874
Branch coverage: 79.8% (99 of 124)
Covered branches: 99
Total branches: 124
Method coverage: Feature is only available for sponsors

Risk Hotspots

Assembly Class Method Crap Score Cyclomatic complexity
ConsoleApp ConsoleApp.Program DoRootCommand(...) 110 10

Coverage

Name Covered Uncovered Coverable Total Line coverage Covered Total Branch coverage
BranchIssues 127 4 131 708 96.9% 40 50 80%
Issue1313.Repo1313 14 0 14 32 100% 10 10 100%
Issue1337.Data 1 0 1 45 100% 0 0
Issue1337.DoerOfStuff 22 0 22 45 100% 0 0
Issue1561.MyAsyncClass 3 0 3 16 100% 0 0
Issue1561.MyRecord 1 0 1 16 100% 0 0
Issue1633.BasicFolderDto 1 1 2 62 50% 0 0
Issue1633.DeleteFolderDto 0 2 2 62 0% 0 0
Issue1633.FolderInfoDto 2 0 2 62 100% 0 0
Issue1633.FolderService 21 0 21 62 100% 9 10 90%
Issue1633.FolderSource 2 0 2 62 100% 0 0
Issue1644.ServiceExtensions 6 0 6 21 100% 3 4 75%
Issue1717.Class1717 5 1 6 25 83.3% 0 0
Issue1767.Class1767 4 0 4 13 100% 0 0
Issue1786.Class1786 7 0 7 15 100% 1 2 50%
Issue1937.Class1937 13 0 13 26 100% 1 2 50%
Issue1968.TheFunction 7 0 7 21 100% 4 4 100%
Issue1969.IsOr 6 0 6 41 100% 5 6 83.3%
Issue1969.IsOrPartial 6 0 6 41 100% 4 6 66.6%
Issue1969.IsOrWithout 6 0 6 41 100% 3 6 50%
ClassIssue1334 169 2 171 373 98.8% 55 60 91.6%
ClassIssue1334.AsyncEnumerableBatchExtensionReproduction 14 0 14 27 100% 6 6 100%
ClassIssue1334.AsyncThrowReproduction 11 0 11 25 100% 2 2 100%
ClassIssue1334.AwaitForeachReproduction 15 0 15 29 100% 6 6 100%
ClassIssue1334.AwaitForeachReproduction2 6 0 6 16 100% 2 2 100%
ClassIssue1334.AwaitUsingReproduction 3 0 3 14 100% 0 0
ClassIssue1334.AwaitUsingReturnInIfStatementReproduction 49 2 51 77 96% 8 8 100%
ClassIssue1334.CoverletRepro 14 0 14 31 100% 10 10 100%
ClassIssue1334.CustomException 5 0 5 31 100% 0 0
ClassIssue1334.ExcludedLocalFunctionReproduction 6 0 6 24 100% 0 0
ClassIssue1334.ThrowExceptionViaMethodReproduction 6 0 6 31 100% 2 2 100%
ClassIssue1334.TwoConditionsBranchCoverageReproduction 40 0 40 68 100% 19 24 79.1%
ClassLibrary1 3 0 3 9 100% 0 0 ****
ClassLibrary1.Class1 3 0 3 9 100% 0 0
ConsoleApp 20 39 59 93 33.8% 0 10 0%
ConsoleApp.Calculate 20 0 20 32 100% 0 0
ConsoleApp.Program 0 39 39 61 0% 0 10 0%
Issue1417 27 0 27 59 100% 4 4 100%
Issue1417.Class1417 27 0 27 59 100% 4 4 100%
MediatorApi1718 0 9 9 15 0% 0 0 ****
Program 0 9 9 15 0% 0 0
MediatorApp1718 12 0 12 29 100% 0 0 ****
MediatorApp1718.ApplicationExtensions 9 0 9 18 100% 0 0
MediatorApp1718.PingQueryHandler 3 0 3 11 100% 0 0
Mtp1934.Core 3 0 3 10 100% 0 0 ****
Mtp1934.Core.Class1 3 0 3 10 100% 0 0

Issue1313.Repo1313

Summary

Class: Issue1313.Repo1313
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1313.cs
Line coverage: 100% (14 of 14)
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 32
Branch coverage: 100% (10 of 10)
Covered branches: 10
Total branches: 10
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
TestString(...) 100% 4 4 100%
TestStringOld(...) 100% 6 6 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1313.cs

 1            using System.Linq;
 2            
 3            namespace Issue1313
 4            {
 5              public class Repo1313
 6              {
 7                public static class CoverletRepro
 8                {
 9                  public static bool TestString(string test)
10  ✔  20           {
11  ✔  20             char lastDigit = test.Last();
12  ✔  20  ●          if (test.StartsWith("123") && lastDigit is >= '0' and <= '7')
13  ✔   8             {
14  ✔   8               return true;
15                    }
16            
17  ✔  12             return false;
18  ✔  20           }
19            
20                  public static bool TestStringOld(string test)
21  ✔  20           {
22  ✔  20             char lastDigit = test.Last();
23  ✔  20  ●          if (test.StartsWith("123") && lastDigit >= '0' && lastDigit <= '7')
24  ✔   8             {
25  ✔   8               return true;
26                    }
27            
28  ✔  12             return false;
29  ✔  20           }
30                }
31              }
32            }

Issue1337.Data

Summary

Class: Issue1337.Data
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1337.cs
Line coverage: 100% (1 of 1)
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 45
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
get_One() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1337.cs

 1           using System;
 2           using System.IO;
 3           using System.Threading.Tasks;
 4           using Microsoft.Extensions.Logging;
 5           
 6           namespace Issue1337;
 7           
 8  ✔  6     public record Data(int One, string Two);
 9           public class DoerOfStuff
10           {
11             private readonly ILogger<DoerOfStuff> _log;
12           
13             public DoerOfStuff(ILogger<DoerOfStuff> log)
14             {
15               _log = log;
16             }
17           
18             public void StartWithoutWaiting(Data data)
19             {
20               Task.Run(() => ActualWork(data));
21             }
22           
23             private async Task ActualWork(Data data)
24             {
25               (int one, string? two) = data;
26               try
27               {
28           
29                 int res = one++;
30                 _log.LogInformation($"Res {res}");
31               }
32               catch (Exception exception)
33               {
34                 _log.LogError(exception, "Something bad happened");
35               }
36               finally
37               {
38                 _log.LogInformation("I'm finally here");
39                 const string filePath = "simple.txt";
40                 const string text = $"Hello World";
41           
42                 await File.WriteAllTextAsync(filePath, text);
43               }
44             }
45           }

Issue1337.DoerOfStuff

Summary

Class: Issue1337.DoerOfStuff
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1337.cs
Line coverage: 100% (22 of 22)
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 45
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...) 100% 1 1 100%
StartWithoutWaiting(...) 100% 1 1 100%
ActualWork() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1337.cs

 1           using System;
 2           using System.IO;
 3           using System.Threading.Tasks;
 4           using Microsoft.Extensions.Logging;
 5           
 6           namespace Issue1337;
 7           
 8           public record Data(int One, string Two);
 9           public class DoerOfStuff
10           {
11             private readonly ILogger<DoerOfStuff> _log;
12           
13  ✔  2       public DoerOfStuff(ILogger<DoerOfStuff> log)
14  ✔  2       {
15  ✔  2         _log = log;
16  ✔  2       }
17           
18             public void StartWithoutWaiting(Data data)
19  ✔  2       {
20  ✔  4         Task.Run(() => ActualWork(data));
21  ✔  2       }
22           
23             private async Task ActualWork(Data data)
24  ✔  2       {
25  ✔  2         (int one, string? two) = data;
26               try
27  ✔  2         {
28           
29  ✔  2           int res = one++;
30  ✔  2           _log.LogInformation($"Res {res}");
31  ✔  1         }
32  ✔  1         catch (Exception exception)
33  ✔  1         {
34  ✔  1           _log.LogError(exception, "Something bad happened");
35  ✔  1         }
36               finally
37  ✔  2         {
38  ✔  2           _log.LogInformation("I'm finally here");
39                 const string filePath = "simple.txt";
40                 const string text = $"Hello World";
41           
42  ✔  2           await File.WriteAllTextAsync(filePath, text);
43  ✔  2         }
44  ✔  2       }
45           }

Issue1561.MyAsyncClass

Summary

Class: Issue1561.MyAsyncClass
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1561.cs
Line coverage: 100% (3 of 3)
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 16
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
DoAsyncAction() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1561.cs

 1           using System.Threading.Tasks;
 2           
 3           namespace Issue1561
 4           {
 5             public class MyAsyncClass
 6             {
 7           #pragma warning disable CA1822 // Mark members as static
 8               public async Task<int> DoAsyncAction()
 9           #pragma warning restore CA1822 // Mark members as static
10  ✔  1         {
11  ✔  1           return await Task.FromResult<int>(1);
12  ✔  1         }
13             }
14           
15             public record MyRecord(int A);
16           }

Issue1561.MyRecord

Summary

Class: Issue1561.MyRecord
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1561.cs
Line coverage: 100% (1 of 1)
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 16
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
get_A() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1561.cs

 1           using System.Threading.Tasks;
 2           
 3           namespace Issue1561
 4           {
 5             public class MyAsyncClass
 6             {
 7           #pragma warning disable CA1822 // Mark members as static
 8               public async Task<int> DoAsyncAction()
 9           #pragma warning restore CA1822 // Mark members as static
10               {
11                 return await Task.FromResult<int>(1);
12               }
13             }
14           
15  ✔  2       public record MyRecord(int A);
16           }

Issue1633.BasicFolderDto

Summary

Class: Issue1633.BasicFolderDto
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs
Line coverage: 50% (1 of 2)
Covered lines: 1
Uncovered lines: 1
Coverable lines: 2
Total lines: 62
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
get_DfsMappedPath() 100% 2 1 0%
get_Path() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs

 1            using System.Collections.Generic;
 2            
 3            namespace Issue1633;
 4            
 5            public sealed record FolderInfoDto
 6            {
 7              public bool IsHidden { get; init; }
 8              public long Creation { get; init; }
 9            }
10            
11            public sealed record FolderSource
12            {
13              public string? Mode { get; init; }
14              public long Creation { get; init; }
15            }
16            
17            public abstract record BasicFolderDto
18            {
19  ❌  0       public string? DfsMappedPath { get; init; }
20  ✔  12       public string Path { get; init; } = null!;
21            }
22            
23            public sealed record CreateFolderDto : BasicFolderDto;
24            
25            public sealed record DeleteFolderDto : BasicFolderDto
26            {
27              public bool Recurse { get; init; }
28              public bool Force { get; init; }
29            }
30            
31            public static class FolderService
32            {
33              /// <summary>Maps a <see cref="FolderSource"/> to a <see cref="FolderInfoDto"/>.</summary>
34              public static FolderInfoDto MapToInfo(FolderSource f)
35              {
36                return new()
37                {
38                  Creation = f.Creation,
39                  IsHidden = f.Mode is { Length: > 3 } mode && mode[3] == 'h'
40                };
41              }
42            
43              /// <summary>Creates a <see cref="CreateFolderDto"/> from an optional args dictionary.</summary>
44              public static CreateFolderDto BuildCreateDto(Dictionary<string, object>? args)
45              {
46                return new()
47                {
48                  Path = args != null && args.TryGetValue("path", out object? path) && path is string s
49                     ? s
50                    : @"F:\rep1\rep2",
51                };
52              }
53            
54              /// <summary>Creates a <see cref="DeleteFolderDto"/> for the given path.</summary>
55              public static DeleteFolderDto BuildDeleteDto(string folderPath)
56              {
57                return new()
58                {
59                  Path = folderPath,
60                };
61              }
62            }

Issue1633.DeleteFolderDto

Summary

Class: Issue1633.DeleteFolderDto
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs
Line coverage: 0% (0 of 2)
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 62
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
get_Recurse() 100% 2 1 0%
get_Force() 100% 2 1 0%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs

 1           using System.Collections.Generic;
 2           
 3           namespace Issue1633;
 4           
 5           public sealed record FolderInfoDto
 6           {
 7             public bool IsHidden { get; init; }
 8             public long Creation { get; init; }
 9           }
10           
11           public sealed record FolderSource
12           {
13             public string? Mode { get; init; }
14             public long Creation { get; init; }
15           }
16           
17           public abstract record BasicFolderDto
18           {
19             public string? DfsMappedPath { get; init; }
20             public string Path { get; init; } = null!;
21           }
22           
23           public sealed record CreateFolderDto : BasicFolderDto;
24           
25           public sealed record DeleteFolderDto : BasicFolderDto
26           {
27  ❌ 0       public bool Recurse { get; init; }
28  ❌ 0       public bool Force { get; init; }
29           }
30           
31           public static class FolderService
32           {
33             /// <summary>Maps a <see cref="FolderSource"/> to a <see cref="FolderInfoDto"/>.</summary>
34             public static FolderInfoDto MapToInfo(FolderSource f)
35             {
36               return new()
37               {
38                 Creation = f.Creation,
39                 IsHidden = f.Mode is { Length: > 3 } mode && mode[3] == 'h'
40               };
41             }
42           
43             /// <summary>Creates a <see cref="CreateFolderDto"/> from an optional args dictionary.</summary>
44             public static CreateFolderDto BuildCreateDto(Dictionary<string, object>? args)
45             {
46               return new()
47               {
48                 Path = args != null && args.TryGetValue("path", out object? path) && path is string s
49                    ? s
50                   : @"F:\rep1\rep2",
51               };
52             }
53           
54             /// <summary>Creates a <see cref="DeleteFolderDto"/> for the given path.</summary>
55             public static DeleteFolderDto BuildDeleteDto(string folderPath)
56             {
57               return new()
58               {
59                 Path = folderPath,
60               };
61             }
62           }

Issue1633.FolderInfoDto

Summary

Class: Issue1633.FolderInfoDto
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs
Line coverage: 100% (2 of 2)
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 62
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
get_IsHidden() 100% 1 1 100%
get_Creation() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs

 1           using System.Collections.Generic;
 2           
 3           namespace Issue1633;
 4           
 5           public sealed record FolderInfoDto
 6           {
 7  ✔  8       public bool IsHidden { get; init; }
 8  ✔  5       public long Creation { get; init; }
 9           }
10           
11           public sealed record FolderSource
12           {
13             public string? Mode { get; init; }
14             public long Creation { get; init; }
15           }
16           
17           public abstract record BasicFolderDto
18           {
19             public string? DfsMappedPath { get; init; }
20             public string Path { get; init; } = null!;
21           }
22           
23           public sealed record CreateFolderDto : BasicFolderDto;
24           
25           public sealed record DeleteFolderDto : BasicFolderDto
26           {
27             public bool Recurse { get; init; }
28             public bool Force { get; init; }
29           }
30           
31           public static class FolderService
32           {
33             /// <summary>Maps a <see cref="FolderSource"/> to a <see cref="FolderInfoDto"/>.</summary>
34             public static FolderInfoDto MapToInfo(FolderSource f)
35             {
36               return new()
37               {
38                 Creation = f.Creation,
39                 IsHidden = f.Mode is { Length: > 3 } mode && mode[3] == 'h'
40               };
41             }
42           
43             /// <summary>Creates a <see cref="CreateFolderDto"/> from an optional args dictionary.</summary>
44             public static CreateFolderDto BuildCreateDto(Dictionary<string, object>? args)
45             {
46               return new()
47               {
48                 Path = args != null && args.TryGetValue("path", out object? path) && path is string s
49                    ? s
50                   : @"F:\rep1\rep2",
51               };
52             }
53           
54             /// <summary>Creates a <see cref="DeleteFolderDto"/> for the given path.</summary>
55             public static DeleteFolderDto BuildDeleteDto(string folderPath)
56             {
57               return new()
58               {
59                 Path = folderPath,
60               };
61             }
62           }

Issue1633.FolderService

Summary

Class: Issue1633.FolderService
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs
Line coverage: 100% (21 of 21)
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 62
Branch coverage: 90% (9 of 10)
Covered branches: 9
Total branches: 10
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
MapToInfo(...) 100% 4 4 100%
BuildCreateDto(...) 83.33% 6 6 100%
BuildDeleteDto(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs

 1           using System.Collections.Generic;
 2           
 3           namespace Issue1633;
 4           
 5           public sealed record FolderInfoDto
 6           {
 7             public bool IsHidden { get; init; }
 8             public long Creation { get; init; }
 9           }
10           
11           public sealed record FolderSource
12           {
13             public string? Mode { get; init; }
14             public long Creation { get; init; }
15           }
16           
17           public abstract record BasicFolderDto
18           {
19             public string? DfsMappedPath { get; init; }
20             public string Path { get; init; } = null!;
21           }
22           
23           public sealed record CreateFolderDto : BasicFolderDto;
24           
25           public sealed record DeleteFolderDto : BasicFolderDto
26           {
27             public bool Recurse { get; init; }
28             public bool Force { get; init; }
29           }
30           
31           public static class FolderService
32           {
33             /// <summary>Maps a <see cref="FolderSource"/> to a <see cref="FolderInfoDto"/>.</summary>
34             public static FolderInfoDto MapToInfo(FolderSource f)
35  ✔  4       {
36  ✔  4  ●      return new()
37  ✔  4         {
38  ✔  4           Creation = f.Creation,
39  ✔  4           IsHidden = f.Mode is { Length: > 3 } mode && mode[3] == 'h'
40  ✔  4         };
41  ✔  4       }
42           
43             /// <summary>Creates a <see cref="CreateFolderDto"/> from an optional args dictionary.</summary>
44             public static CreateFolderDto BuildCreateDto(Dictionary<string, object>? args)
45  ✔  3       {
46  ✓  3  ◕      return new()
47  ✔  3         {
48  ✔  3           Path = args != null && args.TryGetValue("path", out object? path) && path is string s
49  ✔  3              ? s
50  ✔  3             : @"F:\rep1\rep2",
51  ✔  3         };
52  ✔  3       }
53           
54             /// <summary>Creates a <see cref="DeleteFolderDto"/> for the given path.</summary>
55             public static DeleteFolderDto BuildDeleteDto(string folderPath)
56  ✔  1       {
57  ✔  1         return new()
58  ✔  1         {
59  ✔  1           Path = folderPath,
60  ✔  1         };
61  ✔  1       }
62           }

Issue1633.FolderSource

Summary

Class: Issue1633.FolderSource
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs
Line coverage: 100% (2 of 2)
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 62
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
get_Mode() 100% 1 1 100%
get_Creation() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1633.cs

 1           using System.Collections.Generic;
 2           
 3           namespace Issue1633;
 4           
 5           public sealed record FolderInfoDto
 6           {
 7             public bool IsHidden { get; init; }
 8             public long Creation { get; init; }
 9           }
10           
11           public sealed record FolderSource
12           {
13  ✔  8       public string? Mode { get; init; }
14  ✔  8       public long Creation { get; init; }
15           }
16           
17           public abstract record BasicFolderDto
18           {
19             public string? DfsMappedPath { get; init; }
20             public string Path { get; init; } = null!;
21           }
22           
23           public sealed record CreateFolderDto : BasicFolderDto;
24           
25           public sealed record DeleteFolderDto : BasicFolderDto
26           {
27             public bool Recurse { get; init; }
28             public bool Force { get; init; }
29           }
30           
31           public static class FolderService
32           {
33             /// <summary>Maps a <see cref="FolderSource"/> to a <see cref="FolderInfoDto"/>.</summary>
34             public static FolderInfoDto MapToInfo(FolderSource f)
35             {
36               return new()
37               {
38                 Creation = f.Creation,
39                 IsHidden = f.Mode is { Length: > 3 } mode && mode[3] == 'h'
40               };
41             }
42           
43             /// <summary>Creates a <see cref="CreateFolderDto"/> from an optional args dictionary.</summary>
44             public static CreateFolderDto BuildCreateDto(Dictionary<string, object>? args)
45             {
46               return new()
47               {
48                 Path = args != null && args.TryGetValue("path", out object? path) && path is string s
49                    ? s
50                   : @"F:\rep1\rep2",
51               };
52             }
53           
54             /// <summary>Creates a <see cref="DeleteFolderDto"/> for the given path.</summary>
55             public static DeleteFolderDto BuildDeleteDto(string folderPath)
56             {
57               return new()
58               {
59                 Path = folderPath,
60               };
61             }
62           }

Issue1644.ServiceExtensions

Summary

Class: Issue1644.ServiceExtensions
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1644.cs
Line coverage: 100% (6 of 6)
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 21
Branch coverage: 75% (3 of 4)
Covered branches: 3
Total branches: 4
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
IsInPast(...) 75.00% 4 4 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1644.cs

 1           using System;
 2           
 3           namespace Issue1644
 4           {
 5             public interface IService
 6             {
 7               TimeOnly? GetTime();
 8             }
 9             public static class ServiceExtensions
10             {
11               public static bool IsInPast(this IService service)
12  ✔  3         {
13  ✔  3           TimeOnly? timeFromService = service.GetTime();
14  ✔  4  ●        if (!timeFromService.HasValue) return true;
15           
16  ✓  2  ◑        bool isInPast = timeFromService < TimeOnly.FromDateTime(DateTime.UtcNow);
17           
18  ✔  2           return isInPast;
19  ✔  3         }
20             }
21           }

Issue1717.Class1717

Summary

Class: Issue1717.Class1717
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1717.cs
Line coverage: 83.3% (5 of 6)
Covered lines: 5
Uncovered lines: 1
Coverable lines: 6
Total lines: 25
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Throw(...) 100% 1 1 100%
ThrowMethodWithMessageAsync() 100% 1 1 75.00%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1717.cs

 1           using System;
 2           using System.Diagnostics.CodeAnalysis;
 3           using System.Threading.Tasks;
 4           
 5           namespace Issue1717
 6           {
 7             public class Class1717
 8             {
 9               internal static class ThrowHelper
10               {
11                 [DoesNotReturn]
12                 public static void Throw(Exception e)
13  ✔  1           {
14  ✔  1             throw e;
15                 }
16               }
17           
18               public async Task ThrowMethodWithMessageAsync(string message)
19  ✔  1         {
20  ✔  1           Console.WriteLine(message);
21  ✔  1           ThrowHelper.Throw(new Exception());
22  ❌ 0         }
23             }
24           
25           }

Issue1767.Class1767

Summary

Class: Issue1767.Class1767
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1767.cs
Line coverage: 100% (4 of 4)
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 13
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
.ctor() 100% 1 1 100%
Exists(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1767.cs

 1           using System.Collections.Generic;
 2           using System.Linq;
 3           
 4           namespace Issue1767;
 5           
 6           public class Class1767
 7           {
 8  ✔  1       private readonly List<string> _items = new List<string> { "One", "two" };
 9             public IEnumerable<string> Exists(string name)
10  ✔  1       {
11  ✔  3         return _items.Where(x => x == name);
12  ✔  1       }
13           }

Issue1786.Class1786

Summary

Class: Issue1786.Class1786
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1786.cs
Line coverage: 100% (7 of 7)
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 15
Branch coverage: 50% (1 of 2)
Covered branches: 1
Total branches: 2
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Test1(...) 50.0% 2 2 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1786.cs

 1           using System;
 2           
 3           namespace Issue1786;
 4           
 5           public static class Class1786
 6           {
 7             public static int Test1(int n)
 8  ✔  1       {
 9  ✓  1  ◑      if (n < 10)
10  ✔  1         {
11  ✔  1           n = Random.Shared.Next();
12  ✔  1         }
13  ✔  1         return n;
14  ✔  1       }
15           }

Issue1937.Class1937

Summary

Class: Issue1937.Class1937
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1937.cs
Line coverage: 100% (13 of 13)
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 26
Branch coverage: 50% (1 of 2)
Covered branches: 1
Total branches: 2
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
ConfigureSecretsManager(...) 50.0% 2 2 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1937.cs

 1           using System;
 2           using System.Linq;
 3           using AWSSecretsManager.Provider;
 4           using Microsoft.Extensions.Configuration;
 5           
 6           namespace Issue1937;
 7           
 8           public static class Class1937
 9           {
10             public static IConfigurationBuilder ConfigureSecretsManager(this IConfigurationBuilder builder)
11  ✔  1       {
12  ✔  1         string[] prefixes = ["/Test/"];
13           
14  ✔  1         builder.AddSecretsManager(configurator: (options) =>
15  ✔  1         {
16  ✓  1  ◑        options.SecretFilter = (secret) =>
17  ✔  2           {
18  ✔  2             return prefixes.Any(prefix =>
19  ✔  2                 secret.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)
20  ✔  2             );
21  ✔  3           };
22  ✔  2         });
23           
24  ✔  1         return builder;
25  ✔  1       }
26           }

Issue1968.TheFunction

Summary

Class: Issue1968.TheFunction
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1968.cs
Line coverage: 100% (7 of 7)
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 21
Branch coverage: 100% (4 of 4)
Covered branches: 4
Total branches: 4
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
FunctionThatReturnsIAsyncEnumerable() 100% 4 4 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1968.cs

 1            using System;
 2            using System.Collections.Generic;
 3            using System.Runtime.CompilerServices;
 4            using System.Threading;
 5            
 6            namespace Issue1968
 7            {
 8              public class TheFunction
 9              {
10            #pragma warning disable IDE0390 // Make method synchronous
11                public static async IAsyncEnumerable<T?> FunctionThatReturnsIAsyncEnumerable<T>([EnumeratorCancellation] Cancellatio
12            #pragma warning restore IDE0390 // Make method synchronous
13  ✔   3         {
14  ✔   3           T?[] items = [default, default];
15  ✔  17  ●        foreach (T? item in items)
16  ✔   5           {
17  ✔   5  ●          yield return !cancellationToken.IsCancellationRequested ? item : throw new OperationCanceledException();
18  ✔   3           }
19  ✔   1         }
20              }
21            }

Issue1969.IsOr

Summary

Class: Issue1969.IsOr
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1969.cs
Line coverage: 100% (6 of 6)
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 41
Branch coverage: 83.3% (5 of 6)
Covered branches: 5
Total branches: 6
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Operator(...) 100% 2 2 100%
PatternMatching(...) 75.00% 4 4 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1969.cs

 1           namespace Issue1969
 2           {
 3             public static class IsOr
 4             {
 5               public static bool Operator(string text)
 6  ✔  2         {
 7  ✔  2  ●        return text == "hello" || text == "world";
 8  ✔  2         }
 9           
10               public static bool PatternMatching(string text)
11  ✔  2         {
12  ✓  2  ◑        return text is "hello" or "world";
13  ✔  2         }
14             }
15           
16             public static class IsOrPartial
17             {
18               public static bool Operator(string text)
19               {
20                 return text == "hello" || text == "world";
21               }
22           
23               public static bool PatternMatching(string text)
24               {
25                 return text is "hello" or "world";
26               }
27             }
28           
29             public static class IsOrWithout
30             {
31               public static bool Operator(string text)
32               {
33                 return text == "hello" || text == "world";
34               }
35           
36               public static bool PatternMatching(string text)
37               {
38                 return text is "hello" or "world";
39               }
40             }
41           }

Issue1969.IsOrPartial

Summary

Class: Issue1969.IsOrPartial
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1969.cs
Line coverage: 100% (6 of 6)
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 41
Branch coverage: 66.6% (4 of 6)
Covered branches: 4
Total branches: 6
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Operator(...) 50.0% 2 2 100%
PatternMatching(...) 75.00% 4 4 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1969.cs

 1           namespace Issue1969
 2           {
 3             public static class IsOr
 4             {
 5               public static bool Operator(string text)
 6               {
 7                 return text == "hello" || text == "world";
 8               }
 9           
10               public static bool PatternMatching(string text)
11               {
12                 return text is "hello" or "world";
13               }
14             }
15           
16             public static class IsOrPartial
17             {
18               public static bool Operator(string text)
19  ✔  1         {
20  ✓  1  ◑        return text == "hello" || text == "world";
21  ✔  1         }
22           
23               public static bool PatternMatching(string text)
24  ✔  1         {
25  ✓  1  ◑        return text is "hello" or "world";
26  ✔  1         }
27             }
28           
29             public static class IsOrWithout
30             {
31               public static bool Operator(string text)
32               {
33                 return text == "hello" || text == "world";
34               }
35           
36               public static bool PatternMatching(string text)
37               {
38                 return text is "hello" or "world";
39               }
40             }
41           }

Issue1969.IsOrWithout

Summary

Class: Issue1969.IsOrWithout
Assembly: BranchIssues
File(s): D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1969.cs
Line coverage: 100% (6 of 6)
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 41
Branch coverage: 50% (3 of 6)
Covered branches: 3
Total branches: 6
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Operator(...) 50.0% 2 2 100%
PatternMatching(...) 50.0% 4 4 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\BranchIssues\Issue1969.cs

 1           namespace Issue1969
 2           {
 3             public static class IsOr
 4             {
 5               public static bool Operator(string text)
 6               {
 7                 return text == "hello" || text == "world";
 8               }
 9           
10               public static bool PatternMatching(string text)
11               {
12                 return text is "hello" or "world";
13               }
14             }
15           
16             public static class IsOrPartial
17             {
18               public static bool Operator(string text)
19               {
20                 return text == "hello" || text == "world";
21               }
22           
23               public static bool PatternMatching(string text)
24               {
25                 return text is "hello" or "world";
26               }
27             }
28           
29             public static class IsOrWithout
30             {
31               public static bool Operator(string text)
32  ✔  1         {
33  ✓  1  ◑        return text == "hello" || text == "world";
34  ✔  1         }
35           
36               public static bool PatternMatching(string text)
37  ✔  1         {
38  ✓  1  ◑        return text is "hello" or "world";
39  ✔  1         }
40             }
41           }

ClassIssue1334.AsyncEnumerableBatchExtensionReproduction

Summary

Class: ClassIssue1334.AsyncEnumerableBatchExtensionReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AsyncEnumerableBatchExtensionReproduction.cs
Line coverage: 100% (14 of 14)
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 27
Branch coverage: 100% (6 of 6)
Covered branches: 6
Total branches: 6
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
ExecuteReproduction() 100% 2 2 100%
YieldBatch() 100% 4 4 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AsyncEnumerableBatchExtensionReproduction.cs

 1             // issue 1334
 2             using System.Collections.Generic;
 3             
 4             namespace ClassIssue1334;
 5             
 6             public static class AsyncEnumerableBatchExtensionReproduction
 7             {
 8               public static async IAsyncEnumerable<IAsyncEnumerable<T>> ExecuteReproduction<T>(this IAsyncEnumerable<T> source, int 
 9  ✔    1       {
10  ✔    1         await using IAsyncEnumerator<T> enumerator = source.GetAsyncEnumerator();
11             
12  ✔   11  ●      while (await enumerator.MoveNextAsync())
13  ✔   10         {
14  ✔   10           yield return YieldBatch(enumerator, batchSize);
15  ✔   10         }
16  ✔    1       }
17             
18               private static async IAsyncEnumerable<T> YieldBatch<T>(IAsyncEnumerator<T> source, int batchSize)
19  ✔   10       {
20  ✔   10         yield return source.Current;
21             
22  ✔  190  ●      for (int i = 1; i < batchSize && await source.MoveNextAsync(); i++)
23  ✔   85         {
24  ✔   85           yield return source.Current;
25  ✔   85         }
26  ✔   10       }
27             }

ClassIssue1334.AsyncThrowReproduction

Summary

Class: ClassIssue1334.AsyncThrowReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AsyncThrowReproduction.cs
Line coverage: 100% (11 of 11)
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 25
Branch coverage: 100% (2 of 2)
Covered branches: 2
Total branches: 2
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Execute() 100% 2 2 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AsyncThrowReproduction.cs

 1           // issue 1334
 2           using System;
 3           using System.Threading.Tasks;
 4           
 5           namespace ClassIssue1334;
 6           
 7           public class AsyncThrowReproduction
 8           {
 9             public async Task Execute(bool throwException)
10  ✔  2       {
11               try
12  ✔  2         {
13  ✔  2  ●        if (throwException)
14  ✔  1           {
15  ✔  1             throw new InvalidOperationException();
16                 }
17  ✔  1         }
18  ✔  1         catch (InvalidOperationException)
19  ✔  1         {
20  ✔  1           await Task.Delay(1);
21  ✔  1           throw;
22               }
23  ✔  1       }
24           
25           }

ClassIssue1334.AwaitForeachReproduction

Summary

Class: ClassIssue1334.AwaitForeachReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitForeachReproduction.cs
Line coverage: 100% (15 of 15)
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 29
Branch coverage: 100% (6 of 6)
Covered branches: 6
Total branches: 6
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Execute() 100% 2 2 100%
AsyncEnumerable() 100% 4 4 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitForeachReproduction.cs

 1             // issue 1334
 2             using System.Collections.Generic;
 3             using System.Threading.Tasks;
 4             
 5             namespace ClassIssue1334;
 6             
 7             public class AwaitForeachReproduction
 8             {
 9               public async Task<int> Execute()
10  ✔    1       {
11  ✔    1         int sum = 0;
12             
13  ✔  203  ●      await foreach (int result in AsyncEnumerable())
14  ✔  100         {
15  ✔  100           sum += result;
16  ✔  100         }
17             
18  ✔    1         return sum;
19  ✔    1       }
20             
21               private async IAsyncEnumerable<int> AsyncEnumerable()
22  ✔    1       {
23  ✔  202  ●      for (int i = 0; i < 100; i++)
24  ✔  100         {
25  ✔  100  ●        await Task.Yield();
26  ✔  100           yield return i;
27  ✔  100         }
28  ✔    1       }
29             }

ClassIssue1334.AwaitForeachReproduction2

Summary

Class: ClassIssue1334.AwaitForeachReproduction2
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitForeachReproduction2.cs
Line coverage: 100% (6 of 6)
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 16
Branch coverage: 100% (2 of 2)
Covered branches: 2
Total branches: 2
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Execute() 100% 2 2 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitForeachReproduction2.cs

 1           // issue 1334
 2           using System.Collections.Generic;
 3           using System.Threading.Tasks;
 4           
 5           namespace ClassIssue1334;
 6           
 7           public class AwaitForeachReproduction2
 8           {
 9             public virtual async Task Execute<T>(IAsyncEnumerable<int> messages)
10  ✔  1       {
11  ✔  9  ●      await foreach (int obj in messages)
12  ✔  3         {
13  ✔  3           await Task.Delay(1);
14  ✔  3         }
15  ✔  1       }
16           }

ClassIssue1334.AwaitUsingReproduction

Summary

Class: ClassIssue1334.AwaitUsingReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitUsingReproduction.cs
Line coverage: 100% (3 of 3)
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 14
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Execute() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitUsingReproduction.cs

 1           // issue 1334
 2           using System.IO;
 3           using System.Text;
 4           using System.Threading.Tasks;
 5           
 6           namespace ClassIssue1334;
 7           
 8           public class AwaitUsingReproduction
 9           {
10             public async Task Execute()
11  ✔  1       {
12  ✔  1         await using var stream = new MemoryStream(Encoding.UTF8.GetBytes("Hello world!"));
13  ✔  1       }
14           }

ClassIssue1334.AwaitUsingReturnInIfStatementReproduction

Summary

Class: ClassIssue1334.AwaitUsingReturnInIfStatementReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitUsingReturnInIfStatementReproduction.cs
Line coverage: 96% (49 of 51)
Covered lines: 49
Uncovered lines: 2
Coverable lines: 51
Total lines: 77
Branch coverage: 100% (8 of 8)
Covered branches: 8
Total branches: 8
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
ExecuteReproduction() 100% 2 2 90.90%
ExecuteNoIfStatement() 100% 1 1 100%
ExecuteAwaitUsingWithBraces() 100% 2 2 91.66%
ExecuteUsingWithoutAwait() 100% 2 2 100%
ExecuteReturnOutsideIfStatement() 100% 2 2 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\AwaitUsingReturnInIfStatementReproduction.cs

 1           // issue 1334
 2           using System;
 3           using System.IO;
 4           using System.Text;
 5           using System.Threading.Tasks;
 6           
 7           namespace ClassIssue1334;
 8           
 9           public class AwaitUsingReturnInIfStatementReproduction
10           {
11             public async Task<int> ExecuteReproduction(bool isTrue)
12  ✔  2       {
13  ✔  2  ●      if (isTrue)
14  ✔  1         {
15  ✔  1           byte[] bytes = Encoding.ASCII.GetBytes("Words");
16  ✔  1           await using var stream = new MemoryStream(bytes);
17  ✔  1           byte[] byteArray = new byte[stream.Length];
18  ✔  1           int count = await stream.ReadAsync(byteArray.AsMemory(0, 3));
19  ✔  1           return count;
20  ❌ 0         }
21           
22  ✔  1         return 1;
23  ✔  2       }
24           
25             public async Task<int> ExecuteNoIfStatement()
26  ✔  1       {
27  ✔  1         byte[] bytes = Encoding.ASCII.GetBytes("Words");
28  ✔  1         await using var stream = new MemoryStream(bytes);
29  ✔  1         byte[] byteArray = new byte[stream.Length];
30  ✔  1         int count = await stream.ReadAsync(byteArray.AsMemory(0, 3));
31  ✔  1         return count;
32  ✔  1       }
33           
34             public async Task<int> ExecuteAwaitUsingWithBraces(bool isTrue)
35  ✔  2       {
36  ✔  2  ●      if (isTrue)
37  ✔  1         {
38  ✔  1           byte[] bytes = Encoding.ASCII.GetBytes("Words");
39  ✔  1           await using (var stream = new MemoryStream(bytes))
40  ✔  1           {
41  ✔  1             byte[] byteArray = new byte[stream.Length];
42  ✔  1             int count = await stream.ReadAsync(byteArray.AsMemory(0, 3));
43  ✔  1             return count;
44                 }
45  ❌ 0         }
46           
47  ✔  1         return 1;
48  ✔  2       }
49           
50             public async Task<int> ExecuteUsingWithoutAwait(bool isTrue)
51  ✔  2       {
52  ✔  2  ●      if (isTrue)
53  ✔  1         {
54  ✔  1           byte[] bytes = Encoding.ASCII.GetBytes("Words");
55  ✔  1           using var stream = new MemoryStream(bytes);
56  ✔  1           byte[] byteArray = new byte[stream.Length];
57  ✔  1           int count = await stream.ReadAsync(byteArray.AsMemory(0, 3));
58  ✔  1           return count;
59               }
60           
61  ✔  1         return 1;
62  ✔  2       }
63           
64             public async Task<int> ExecuteReturnOutsideIfStatement(bool isTrue)
65  ✔  2       {
66  ✔  2         int count = 1;
67  ✔  2  ●      if (isTrue)
68  ✔  1         {
69  ✔  1           byte[] bytes = Encoding.ASCII.GetBytes("Words");
70  ✔  1           await using var stream = new MemoryStream(bytes);
71  ✔  1           byte[] byteArray = new byte[stream.Length];
72  ✔  1           count = await stream.ReadAsync(byteArray.AsMemory(0, 3));
73  ✔  1         }
74           
75  ✔  2         return count;
76  ✔  2       }
77           }

ClassIssue1334.CoverletRepro

Summary

Class: ClassIssue1334.CoverletRepro
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\CoverletRepro.cs
Line coverage: 100% (14 of 14)
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 31
Branch coverage: 100% (10 of 10)
Covered branches: 10
Total branches: 10
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
TestString(...) 100% 4 4 100%
TestStringOld(...) 100% 6 6 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\CoverletRepro.cs

 1            // issue 1313
 2            
 3            using System.Linq;
 4            
 5            namespace ClassIssue1334
 6            {
 7              public static class CoverletRepro
 8              {
 9                public static bool TestString(string test)
10  ✔  20         {
11  ✔  20           char lastDigit = test.Last();
12  ✔  20  ●        if (test.StartsWith("123") && lastDigit is >= '0' and <= '7')
13  ✔   8           {
14  ✔   8             return true;
15                  }
16            
17  ✔  12           return false;
18  ✔  20         }
19            
20                public static bool TestStringOld(string test)
21  ✔  20         {
22  ✔  20           char lastDigit = test.Last();
23  ✔  20  ●        if (test.StartsWith("123") && lastDigit >= '0' && lastDigit <= '7')
24  ✔   8           {
25  ✔   8             return true;
26                  }
27            
28  ✔  12           return false;
29  ✔  20         }
30              }
31            }

ClassIssue1334.CustomException

Summary

Class: ClassIssue1334.CustomException
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\ThrowExceptionViaMethodReproduction.cs
Line coverage: 100% (5 of 5)
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 31
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...) 100% 1 1 100%
Throw(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\ThrowExceptionViaMethodReproduction.cs

 1           // issue 1334
 2           using System;
 3           using System.Diagnostics.CodeAnalysis;
 4           
 5           namespace ClassIssue1334;
 6           
 7           public static class ThrowExceptionViaMethodReproduction
 8           {
 9             public static void EnsureNull(int? value)
10             {
11               if (!value.HasValue)
12               {
13                 return;
14               }
15           
16               CustomException.Throw(value.Value);
17             }
18           }
19           
20           public class CustomException : InvalidOperationException
21           {
22  ✔  1       public CustomException(string message) : base(message)
23  ✔  1       {
24  ✔  1       }
25           
26             [DoesNotReturn]
27             public static void Throw(int id)
28  ✔  1       {
29  ✔  1         throw new CustomException($"Id '{id}' is not allowed");
30             }
31           }

ClassIssue1334.ExcludedLocalFunctionReproduction

Summary

Class: ClassIssue1334.ExcludedLocalFunctionReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\ExcludedLocalFunctionReproduction.cs
Line coverage: 100% (6 of 6)
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 24
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
SomethingThatIsUsingALocalFunction() 100% 1 1 100%
MethodThatTakesALambda(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\ExcludedLocalFunctionReproduction.cs

 1           // issue 1334
 2           using System;
 3           using System.Diagnostics.CodeAnalysis;
 4           
 5           namespace ClassIssue1334;
 6           
 7           public class ExcludedLocalFunctionReproduction
 8           {
 9             public void SomethingThatIsUsingALocalFunction()
10  ✔  1       {
11  ✔  1         MethodThatTakesALambda(NewMethod());
12           
13               [ExcludeFromCodeCoverage(Justification = "Not testable")]
14               static Func<string, bool> NewMethod()
15               {
16                 return myString => myString.Length == 10;
17               }
18  ✔  1       }
19           
20             private void MethodThatTakesALambda(Func<string, bool> function)
21  ✔  1       {
22  ✔  1         _ = function != null;
23  ✔  1       }
24           }

ClassIssue1334.ThrowExceptionViaMethodReproduction

Summary

Class: ClassIssue1334.ThrowExceptionViaMethodReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\ThrowExceptionViaMethodReproduction.cs
Line coverage: 100% (6 of 6)
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 31
Branch coverage: 100% (2 of 2)
Covered branches: 2
Total branches: 2
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
EnsureNull(...) 100% 2 2 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\ThrowExceptionViaMethodReproduction.cs

 1           // issue 1334
 2           using System;
 3           using System.Diagnostics.CodeAnalysis;
 4           
 5           namespace ClassIssue1334;
 6           
 7           public static class ThrowExceptionViaMethodReproduction
 8           {
 9             public static void EnsureNull(int? value)
10  ✔  2       {
11  ✔  2  ●      if (!value.HasValue)
12  ✔  1         {
13  ✔  1           return;
14               }
15           
16  ✔  1         CustomException.Throw(value.Value);
17  ✔  1       }
18           }
19           
20           public class CustomException : InvalidOperationException
21           {
22             public CustomException(string message) : base(message)
23             {
24             }
25           
26             [DoesNotReturn]
27             public static void Throw(int id)
28             {
29               throw new CustomException($"Id '{id}' is not allowed");
30             }
31           }

ClassIssue1334.TwoConditionsBranchCoverageReproduction

Summary

Class: ClassIssue1334.TwoConditionsBranchCoverageReproduction
Assembly: ClassIssue1334
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\TwoConditionsBranchCoverageReproduction.cs
Line coverage: 100% (40 of 40)
Covered lines: 40
Uncovered lines: 0
Coverable lines: 40
Total lines: 68
Branch coverage: 79.1% (19 of 24)
Covered branches: 19
Total branches: 24
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
ExecuteReproduction(...) 50.0% 2 2 100%
ExecuteReproduction2(...) 50.0% 2 2 100%
ExecuteReproduction3(...) 75.00% 4 4 100%
ExecuteReproduction4(...) 50.0% 2 2 100%
ExecuteReturnBooleanValue(...) 75.00% 4 4 100%
ExecuteSecondAssertIsNeverTrue(...) 100% 2 2 100%
ExecuteSecondAssertIsNeverTrue2(...) 100% 2 2 100%
ExecuteSecondAssertIsNeverTrue3(...) 100% 4 4 100%
ExecuteSecondAssertIsNeverTrue4(...) 100% 2 2 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassIssue1334\TwoConditionsBranchCoverageReproduction.cs

 1           // issue 1334
 2           namespace ClassIssue1334;
 3           
 4           public class TwoConditionsBranchCoverageReproduction
 5           {
 6             public bool ExecuteReproduction(int number)
 7  ✔  2       {
 8  ✓  2  ◑      return number == 1 || number == 2;
 9  ✔  2       }
10           
11             public bool ExecuteReproduction2(int number)
12  ✔  2       {
13  ✓  2  ◑      bool isTrue = number == 1 || number == 2;
14  ✔  2         return isTrue;
15  ✔  2       }
16           
17             public bool ExecuteReproduction3(int number)
18  ✔  2       {
19  ✓  2  ◑      bool isTrue = number == 1 || number == 2;
20  ✔  2  ●      if (isTrue)
21  ✔  1         {
22  ✔  1           return true;
23               }
24           
25  ✔  1         return false;
26  ✔  2       }
27           
28             public bool ExecuteReproduction4(int? number)
29  ✔  2       {
30  ✓  2  ◑      return number != null && number == 2;
31  ✔  2       }
32           
33             public bool ExecuteReturnBooleanValue(int number)
34  ✔  2       {
35  ✓  2  ◑      if (number == 1 || number == 2)
36  ✔  1         {
37  ✔  1           return true;
38               }
39  ✔  1         return false;
40  ✔  2       }
41           
42             public bool ExecuteSecondAssertIsNeverTrue(int number)
43  ✔  2       {
44  ✔  2  ●      return number == 1 || number == 2;
45  ✔  2       }
46           
47             public bool ExecuteSecondAssertIsNeverTrue2(int number)
48  ✔  2       {
49  ✔  2  ●      bool isTrue = number == 1 || number == 2;
50  ✔  2         return isTrue;
51  ✔  2       }
52           
53             public bool ExecuteSecondAssertIsNeverTrue3(int number)
54  ✔  2       {
55  ✔  2  ●      bool isTrue = number == 1 || number == 2;
56  ✔  2  ●      if (isTrue)
57  ✔  1         {
58  ✔  1           return true;
59               }
60           
61  ✔  1         return false;
62  ✔  2       }
63           
64             public bool ExecuteSecondAssertIsNeverTrue4(int? number)
65  ✔  2       {
66  ✔  2  ●      return number != null && number == 2;
67  ✔  2       }
68           }

ClassLibrary1.Class1

Summary

Class: ClassLibrary1.Class1
Assembly: ClassLibrary1
File(s): D:\a\coverlet-examples\coverlet-examples\src\ClassLibrary1\Class1.cs
Line coverage: 100% (3 of 3)
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 9
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Method() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ClassLibrary1\Class1.cs

1           namespace ClassLibrary1;
2           
3           public static class Class1
4           {
5             public static int Method()
6  ✔  3       {
7  ✔  3         return 42;
8  ✔  3       }
9           }

ConsoleApp.Calculate

Summary

Class: ConsoleApp.Calculate
Assembly: ConsoleApp
File(s): D:\a\coverlet-examples\coverlet-examples\src\ConsoleApp\Calculate.cs
Line coverage: 100% (20 of 20)
Covered lines: 20
Uncovered lines: 0
Coverable lines: 20
Total lines: 32
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Add(...) 100% 1 1 100%
Subtract(...) 100% 1 1 100%
Multiply(...) 100% 1 1 100%
Divide(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ConsoleApp\Calculate.cs

 1           namespace ConsoleApp;
 2           
 3           internal static class Calculate
 4           {
 5             public static double Add(double n1, double n2)
 6  ✔  4       {
 7  ✔  4         double result = n1 + n2;
 8  ✔  4         Console.WriteLine("Received Add({0},{1}). Return: {2}", n1, n2, result);
 9  ✔  4         return result;
10  ✔  4       }
11           
12             public static double Subtract(double n1, double n2)
13  ✔  4       {
14  ✔  4         double result = n1 - n2;
15  ✔  4         Console.WriteLine("Received Subtract({0},{1}). Return: {2}", n1, n2, result);
16  ✔  4         return result;
17  ✔  4       }
18           
19             public static double Multiply(double n1, double n2)
20  ✔  4       {
21  ✔  4         double result = n1 * n2;
22  ✔  4         Console.WriteLine("Received Multiply({0},{1}). Return: {2}", n1, n2, result);
23  ✔  4         return result;
24  ✔  4       }
25           
26             public static double Divide(double n1, double n2)
27  ✔  6       {
28  ✔  6         double result = n1 / n2;
29  ✔  6         Console.WriteLine("Received Divide({0},{1}). Return: {2}", n1, n2, result);
30  ✔  6         return result;
31  ✔  6       }
32           }

ConsoleApp.Program

Summary

Class: ConsoleApp.Program
Assembly: ConsoleApp
File(s): D:\a\coverlet-examples\coverlet-examples\src\ConsoleApp\Program.cs
Line coverage: 0% (0 of 39)
Covered lines: 0
Uncovered lines: 39
Coverable lines: 39
Total lines: 61
Branch coverage: 0% (0 of 10)
Covered branches: 0
Total branches: 10
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Main() 100% 2 1 0%
DoRootCommand(...) 0% 110 10 0%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\ConsoleApp\Program.cs

 1           using System.CommandLine;
 2           using System.CommandLine.Help;
 3           
 4           namespace ConsoleApp;
 5           
 6           static class Program
 7           {
 8             static async Task Main(string[] args)
 9  ❌ 0       {
10  ❌ 0         Option<int> delayOption = new("--delay") { Description = "delay in seconds", DefaultValueFactory = (_) => 42 };
11  ❌ 0         Option<string> calculateOption = new("--calculate") { DefaultValueFactory = (_) => "add", Required = false, Arity = 
12  ❌ 0         calculateOption.AcceptOnlyFromAmong("add", "subtract", "multiply", "Divide");
13  ❌ 0         Option<string> messageOption = new("--message") { Required = true };
14           
15  ❌ 0         RootCommand rootCommand = new("CommandLine example")
16  ❌ 0         {
17  ❌ 0             delayOption,
18  ❌ 0             messageOption,
19  ❌ 0             new HelpOption(),
20  ❌ 0             new VersionOption() { Description = "SampleConsoleApp version" }
21  ❌ 0         };
22           
23  ❌ 0         ParseResult parseResult = rootCommand.Parse(args);
24           
25  ❌ 0         rootCommand.SetAction(_ =>
26  ❌ 0         {
27  ❌ 0           int delayOptionValue = parseResult.GetValue(delayOption);
28  ❌ 0           string calculateOptionValue = parseResult.GetValue(calculateOption) ?? "";
29  ❌ 0           string messageOptionValue = parseResult.GetValue(messageOption) ?? "unknown";
30  ❌ 0           DoRootCommand(delayOptionValue, messageOptionValue, messageOptionValue);
31  ❌ 0         });
32           
33  ❌ 0         await parseResult.InvokeAsync().ConfigureAwait(false);
34           
35  ❌ 0       }
36           
37             public static void DoRootCommand(int delay, string message, string calculate)
38  ❌ 0       {
39  ❌ 0         Console.WriteLine($"--delay = {delay}");
40  ❌ 0         Console.WriteLine($"--message = {message}");
41  ❌ 0  ○      if (!string.IsNullOrEmpty(calculate))
42  ❌ 0         {
43  ❌ 0           Console.WriteLine($"--calculate = {calculate}");
44  ❌ 0  ○        switch (calculate)
45                 {
46                   case "add":
47  ❌ 0               _ = Calculate.Add(10, 5);
48  ❌ 0               break;
49                   case "subtract":
50  ❌ 0               _ = Calculate.Subtract(10, 5);
51  ❌ 0               break;
52                   case "multiply":
53  ❌ 0               _ = Calculate.Multiply(10, 5);
54  ❌ 0               break;
55                   case "divide":
56  ❌ 0               _ = Calculate.Divide(10, 5);
57  ❌ 0               break;
58                 }
59  ❌ 0         }
60  ❌ 0       }
61           }

Issue1417.Class1417

Summary

Class: Issue1417.Class1417
Assembly: Issue1417
File(s): D:\a\coverlet-examples\coverlet-examples\src\Issue1417\Class1417.cs
Line coverage: 100% (27 of 27)
Covered lines: 27
Uncovered lines: 0
Coverable lines: 27
Total lines: 59
Branch coverage: 100% (4 of 4)
Covered branches: 4
Total branches: 4
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
.cctor() 100% 1 1 100%
M() 100% 4 4 100%
GetValue() 100% 1 1 100%
SetValue(...) 100% 1 1 100%
PerformActionA() 100% 1 1 100%
PerformActionB() 100% 1 1 100%
PerformActionC() 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\Issue1417\Class1417.cs

 1           using System.Diagnostics;
 2           
 3           namespace Issue1417
 4           {
 5           
 6             public enum E
 7             {
 8               A,
 9               B,
10               C,
11             }
12             public static class Class1417
13             {
14  ✔  1         internal static string _actionName = "";
15               internal static E _value;
16               public static void M()
17  ✔  4         {
18  ✔  4           E value = GetValue();
19           
20  ✔  4  ●        switch (value)
21                 {
22                   case E.A:
23  ✔  1               PerformActionA();
24  ✔  1               break;
25           
26                   case E.B:
27  ✔  1               PerformActionB();
28  ✔  1               break;
29           
30                   case E.C:
31  ✔  1               PerformActionC();
32  ✔  1               break;
33           
34                   default:
35  ✔  1               throw new UnreachableException();
36                 }
37  ✔  3         }
38               public static E GetValue()
39  ✔  4         {
40  ✔  4           return _value;
41  ✔  4         }
42               public static void SetValue(E value)
43  ✔  4         {
44  ✔  4           _value = value;
45  ✔  4         }
46               private static void PerformActionA()
47  ✔  1         {
48  ✔  1           _actionName = "ActionA";
49  ✔  1         }
50               private static void PerformActionB()
51  ✔  1         {
52  ✔  1           _actionName = "ActionB";
53  ✔  1         }
54               private static void PerformActionC()
55  ✔  1         {
56  ✔  1           _actionName = "ActionC";
57  ✔  1         }
58             }
59           }

Program

Summary

Class: Program
Assembly: MediatorApi1718
File(s): D:\a\coverlet-examples\coverlet-examples\src\MediatorApi1718\MediatorApi1718.cs
Line coverage: 0% (0 of 9)
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 15
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
$() 100% 2 1 0%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\MediatorApi1718\MediatorApi1718.cs

 1           using MediatorApp1718;
 2           
 3  ❌ 0     WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
 4           
 5  ❌ 0     builder.Services.AddApplication();
 6           
 7  ❌ 0     WebApplication app = builder.Build();
 8           
 9  ❌ 0     app.MapGet("/", () => "Hello World!");
10  ❌ 0     app.MapGet("/ping", async (Mediator.IMediator mediator, CancellationToken cancellationToken) =>
11  ❌ 0     {
12  ❌ 0       return await mediator.Send(new PingQuery("pong"), cancellationToken);
13  ❌ 0     });
14           
15  ❌ 0     await app.RunAsync();

MediatorApp1718.ApplicationExtensions

Summary

Class: MediatorApp1718.ApplicationExtensions
Assembly: MediatorApp1718
File(s): D:\a\coverlet-examples\coverlet-examples\src\MediatorApp1718\ApplicationExtensions.cs
Line coverage: 100% (9 of 9)
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 18
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
AddApplication(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\MediatorApp1718\ApplicationExtensions.cs

 1           using Microsoft.Extensions.DependencyInjection;
 2           
 3           namespace MediatorApp1718;
 4           
 5           public static class ApplicationExtensions
 6           {
 7             public static IServiceCollection AddApplication(this IServiceCollection services)
 8  ✔  1       {
 9  ✔  1         services.AddMediator(options =>
10  ✔  1         {
11  ✔  1           options.ServiceLifetime = ServiceLifetime.Scoped;
12  ✔  1           options.Namespace = "Repro.Application";
13  ✔  1           options.Assemblies = [typeof(ApplicationExtensions)];
14  ✔  1         });
15           
16  ✔  1         return services;
17  ✔  1       }
18           }

MediatorApp1718.PingQueryHandler

Summary

Class: MediatorApp1718.PingQueryHandler
Assembly: MediatorApp1718
File(s): D:\a\coverlet-examples\coverlet-examples\src\MediatorApp1718\PingQueryHandler.cs
Line coverage: 100% (3 of 3)
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 11
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Handle(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\MediatorApp1718\PingQueryHandler.cs

 1           using Mediator;
 2           
 3           namespace MediatorApp1718;
 4           
 5           public sealed class PingQueryHandler : IRequestHandler<PingQuery, string>
 6           {
 7             public ValueTask<string> Handle(PingQuery request, CancellationToken cancellationToken)
 8  ✔  1       {
 9  ✔  1         return ValueTask.FromResult(request.Value);
10  ✔  1       }
11           }

Mtp1934.Core.Class1

Summary

Class: Mtp1934.Core.Class1
Assembly: Mtp1934.Core
File(s): D:\a\coverlet-examples\coverlet-examples\src\Mtp1934.Core\Class1.cs
Line coverage: 100% (3 of 3)
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 10
Covered branches: 0
Total branches: 0
Method coverage: Feature is only available for sponsors

Metrics

Method Branch coverage Crap Score Cyclomatic complexity Line coverage
Add(...) 100% 1 1 100%

File(s)

D:\a\coverlet-examples\coverlet-examples\src\Mtp1934.Core\Class1.cs

 1           namespace Mtp1934.Core
 2           {
 3             public class Class1
 4             {
 5               public static int Add(int a, int b)
 6  ✔  1         {
 7  ✔  1           return a + b;
 8  ✔  1         }
 9             }
10           }

@Bertk Bertk merged commit a7ac743 into main Jul 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants