< Summary

Information
Class: Elsa.Extensions.StringExtensions
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Extensions/StringExtensions.cs
Line coverage
75%
Covered lines: 3
Uncovered lines: 1
Coverable lines: 4
Total lines: 10
Line coverage: 75%
Branch coverage
62%
Covered branches: 5
Total branches: 8
Branch coverage: 62.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
WithDefault(...)0%620%
EmptyIfNull(...)100%22100%
NullIfEmpty(...)50%22100%
NullIfWhiteSpace(...)100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Extensions/StringExtensions.cs

#LineLine coverage
 1// ReSharper disable once CheckNamespace
 2namespace Elsa.Extensions;
 3
 4public static class StringExtensions
 5{
 06    public static string WithDefault(this string? value, string defaultValue) => !string.IsNullOrWhiteSpace(value) ? val
 37    public static string EmptyIfNull(this string? value) => value ?? "";
 33298    public static string? NullIfEmpty(this string? value) => value == "" ? null : value;
 39    public static string? NullIfWhiteSpace(this string? value) => string.IsNullOrWhiteSpace(value) ? null : value;
 10}