< Summary

Information
Class: MyNet.UI.ViewModels.Shell.Host.ShellHostProvider
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/ViewModels/Shell/Host/ShellHostProvider.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 33
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Attach(...)100%11100%
Detach(...)50%22100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/ViewModels/Shell/Host/ShellHostProvider.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ShellHostProvider.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8
 9namespace MyNet.UI.ViewModels.Shell.Host;
 10
 11/// <inheritdoc />
 12public sealed class ShellHostProvider : IShellHostProvider
 13{
 14    /// <inheritdoc />
 15    public IShellHost? Current { get; private set; }
 16
 17    /// <inheritdoc />
 18    public void Attach(IShellHost host)
 19    {
 1220        ArgumentNullException.ThrowIfNull(host);
 1221        Current = host;
 1222    }
 23
 24    /// <inheritdoc />
 25    public void Detach(IShellHost host)
 26    {
 327        ArgumentNullException.ThrowIfNull(host);
 28
 329        if (ReferenceEquals(Current, host))
 330            Current = null;
 331    }
 32}
 33