< Summary

Information
Class: MyNet.UI.Loading.BusyScope
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Loading/BusyScope.cs
Tag: 323_28699572109
Line coverage
83%
Covered lines: 5
Uncovered lines: 1
Coverable lines: 6
Total lines: 42
Line coverage: 83.3%
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
.ctor(...)100%11100%
Dispose()50%2275%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Loading/BusyScope.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="BusyScope.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System.Threading;
 8using MyNet.UI.Loading.Models;
 9
 10namespace MyNet.UI.Loading;
 11
 12/// <summary>
 13/// Disposable scope created by <see cref="BusyService"/>.
 14/// </summary>
 15public sealed class BusyScope : IBusyScope
 16{
 17    private readonly BusyService _owner;
 18    private int _disposed;
 19
 20    internal BusyScope(BusyService owner, IBusy busy, CancellationToken cancellationToken)
 21    {
 10822        _owner = owner;
 23        Busy = busy;
 24        CancellationToken = cancellationToken;
 10825    }
 26
 27    /// <inheritdoc />
 28    public IBusy Busy { get; }
 29
 30    /// <inheritdoc />
 31    public CancellationToken CancellationToken { get; }
 32
 33    /// <inheritdoc />
 34    public void Dispose()
 35    {
 10836        if (Interlocked.Exchange(ref _disposed, 1) != 0)
 037            return;
 38
 10839        _owner.Pop(this);
 10840    }
 41}
 42