• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

abatar1 / Environment.Setup / 16553790167

27 Jul 2025 05:38PM UTC coverage: 55.085% (+3.6%) from 51.515%
16553790167

push

github

abatar1
refactor: replace EnvironmentVariableProvider with IEnvironmentReader for improved flexibility

8 of 22 branches covered (36.36%)

Branch coverage included in aggregate %.

12 of 32 new or added lines in 7 files covered. (37.5%)

57 of 96 relevant lines covered (59.38%)

1.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Environment.Setup/EnvironmentVariableReader.cs
1
namespace Environment.Setup;
2

NEW
3
internal sealed class EnvironmentVariableReader(string name) : IEnvironmentReader
×
4
{
5
    /// <summary>
6
    /// Retrieves the value of the specified environment variable.
7
    /// </summary>
8
    /// <returns>
9
    /// A string containing the value of the environment variable.
10
    /// </returns>
11
    /// <exception cref="EnvironmentVariableNullException">
12
    /// Thrown when the environment variable is null, empty, or consists only of whitespace.
13
    /// </exception>
14
    public string GetValue()
15
    {
NEW
16
        var environmentVariable = System.Environment.GetEnvironmentVariable(name)?.Trim();
×
NEW
17
        if (string.IsNullOrWhiteSpace(environmentVariable))
×
NEW
18
            throw new EnvironmentVariableNullException($"Failed to load {name} environment variable, ensure it has been set up");
×
NEW
19
        return environmentVariable;
×
20
    }
21
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc