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

net-daemon / netdaemon / 6682362857

29 Oct 2023 08:56AM UTC coverage: 79.505% (-1.2%) from 80.706%
6682362857

push

github

web-flow
Bump Roslynator.Analyzers from 4.5.0 to 4.6.1 (#960)

Bumps [Roslynator.Analyzers](https://github.com/dotnet/roslynator) from 4.5.0 to 4.6.1.
- [Release notes](https://github.com/dotnet/roslynator/releases)
- [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md)
- [Commits](https://github.com/dotnet/roslynator/compare/v4.5.0...v4.6.1)

---
updated-dependencies:
- dependency-name: Roslynator.Analyzers
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

802 of 1143 branches covered (0.0%)

Branch coverage included in aggregate %.

2895 of 3507 relevant lines covered (82.55%)

50.4 hits per line

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

70.83
/src/HassModel/NetDeamon.HassModel/Entities/EntityState.cs
1
namespace NetDaemon.HassModel.Entities;
2

3
/// <summary>
4
/// Detailed state information
5
/// </summary>
6
public record EntityState
109✔
7
{
8
    /// <summary>Unique id of the entity</summary>
9
    public string EntityId { get; init; } = "";
103✔
10
    
11
    /// <summary>The state </summary>
12
    public string? State { get; init; }
209✔
13

14
    /// <summary>The attributes as a JsonElement</summary>
15
    public JsonElement? AttributesJson { get; init; }
37✔
16
        
17
    /// <summary>
18
    /// The attributes
19
    /// </summary>
20
    public virtual object? Attributes => AttributesJson?.Deserialize<Dictionary<string, object>>() ?? new Dictionary<string, object>();
×
21
    
22
    /// <summary>Last changed, when state changed from and to different values</summary>
23
    public DateTime? LastChanged { get; init; }
13✔
24
    
25
    /// <summary>Last updated, when entity state or attributes changed </summary>
26
    public DateTime? LastUpdated { get; init; }
13✔
27
    
28
    /// <summary>Context</summary>
29
    public Context? Context { get; init; }
13✔
30
        
31
    internal static TEntityState? Map<TEntityState>(EntityState? state)
32
        where TEntityState : class => 
33
        state == null ? null : (TEntityState)Activator.CreateInstance(typeof(TEntityState), state)!;    }
85!
34
    
35
/// <summary>
36
/// Generic EntityState with specific types of State and Attributes
37
/// </summary>
38
/// <typeparam name="TAttributes">The type of the Attributes Property</typeparam>
39
public record EntityState<TAttributes> : EntityState 
×
40
    where TAttributes : class
41
{
42
    private readonly Lazy<TAttributes?> _attributesLazy;
43

44
    /// <summary>
45
    /// Copy constructor from base class
46
    /// </summary>
47
    /// <param name="source"></param>
48
    public EntityState(EntityState source) : base(source)
82✔
49
    {
50
        _attributesLazy = new (() => AttributesJson?.Deserialize<TAttributes>() ?? default);            
100✔
51
    }
82✔
52

53
    /// <inheritdoc/>
54
    public override TAttributes? Attributes => _attributesLazy.Value;
18✔
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

© 2026 Coveralls, Inc