< Summary

Information
Class: MyNet.Platform.Windows.Authentication.WindowsUserPrincipal
Assembly: MyNet.Platform.Windows
File(s): https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.Platform.Windows/Authentication/WindowsUserPrincipal.cs
Tag: 342_31701152804
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 34
Line coverage: 100%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)75%44100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.Platform.Windows/Authentication/WindowsUserPrincipal.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="WindowsUserPrincipal.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Security.Principal;
 9using MyNet.Utilities;
 10
 11namespace MyNet.Platform.Windows.Authentication;
 12
 13/// <summary>
 14/// Represents a Windows user principal with convenient name and domain properties.
 15/// </summary>
 16/// <remarks>
 17/// Initializes a new instance of the <see cref="WindowsUserPrincipal"/> class.
 18/// </remarks>
 19/// <param name="identity">The identity associated with the principal.</param>
 20/// <param name="roles">The roles for the principal.</param>
 21public class WindowsUserPrincipal(IIdentity identity, string[] roles)
 1522    : GenericPrincipal(identity ?? throw new ArgumentNullException(nameof(identity)), roles ?? throw new ArgumentNullExc
 23{
 24    /// <summary>
 25    /// Gets the user name extracted from the identity.
 26    /// </summary>
 1527    public string Name { get; } = identity.GetName();
 28
 29    /// <summary>
 30    /// Gets the domain extracted from the identity.
 31    /// </summary>
 1532    public string Domain { get; } = identity.GetDomain();
 33}
 34