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

loresoft / EntityFrameworkCore.Generator / 15072048022

16 May 2025 03:31PM UTC coverage: 55.392% (-1.4%) from 56.772%
15072048022

push

github

pwelter34
enable nullable support

616 of 1271 branches covered (48.47%)

Branch coverage included in aggregate %.

233 of 397 new or added lines in 61 files covered. (58.69%)

17 existing lines in 11 files now uncovered.

1824 of 3134 relevant lines covered (58.2%)

88.56 hits per line

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

79.31
/src/EntityFrameworkCore.Generator.Core/Options/OptionsBase.cs
1
using System.Runtime.CompilerServices;
2

3
using EntityFrameworkCore.Generator.Extensions;
4

5
namespace EntityFrameworkCore.Generator.Options;
6

7
public class OptionsBase
8
{
9
    /// <summary>
10
    /// Initializes a new instance of the <see cref="OptionsBase" /> class.
11
    /// </summary>
12
    /// <param name="variables">The shared variables dictionary.</param>
13
    /// <param name="prefix">The variable key prefix.</param>
14
    public OptionsBase(VariableDictionary variables, string? prefix)
266✔
15
    {
16
        ArgumentNullException.ThrowIfNull(variables);
266✔
17

18
        Variables = variables;
266✔
19
        Prefix = prefix;
266✔
20
    }
266✔
21

22
    public VariableDictionary Variables { get; }
1,051✔
23

24
    public string? Prefix { get; }
1,051✔
25

26

27
    protected string? GetProperty([CallerMemberName] string? propertyName = null)
28
    {
29
        var name = AppendPrefix(Prefix, propertyName);
345✔
30
        if (name.IsNullOrWhiteSpace())
345!
NEW
31
            return null;
×
32

33
        return Variables.Get(name);
345✔
34
    }
35

36
    protected void SetProperty(string? value, [CallerMemberName] string? propertyName = null)
37
    {
38
        var name = AppendPrefix(Prefix, propertyName);
596✔
39
        if (name.IsNullOrWhiteSpace())
596!
NEW
40
            return;
×
41

42
        Variables.Set(name, value);
596✔
43
    }
596✔
44

45

46
    public static string? AppendPrefix(string? root, string? prefix)
47
    {
48
        if (prefix.IsNullOrWhiteSpace())
1,194!
49
            return root;
×
50

51
        return root.HasValue()
1,194✔
52
            ? $"{root}.{prefix}"
1,194✔
53
            : prefix;
1,194✔
54
    }
55
}
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

© 2025 Coveralls, Inc