< Summary

Information
Class: MyNet.Fakers.Identity.IdentityFaker
Assembly: MyNet.Fakers
File(s): https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.Fakers/Identity/IdentityFaker.cs
Tag: 342_31701152804
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 37
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Username()100%11100%
Password(...)100%22100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.Fakers/Identity/IdentityFaker.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="IdentityFaker.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Text;
 9using MyNet.Fakers.Text;
 10using MyNet.Generator;
 11
 12namespace MyNet.Fakers.Identity;
 13
 14/// <summary>
 15///  Current implementation of <see cref="IIdentityFaker"/>.
 16/// </summary>
 17/// <param name="random">The random generator instance.</param>
 18/// <param name="text">The text faker instance.</param>
 19public sealed class IdentityFaker(IRandomGenerator random, ITextFaker text) : IIdentityFaker
 20{
 21    /// <inheritdoc />
 322    public string Username() => $"{text.Word()}{random.Int(100, 9999)}";
 23
 24    /// <inheritdoc />
 25    public string Password(int length = 12)
 26    {
 327        ArgumentOutOfRangeException.ThrowIfNegative(length);
 28
 329        var builder = new StringBuilder(length);
 30
 3631        for (var i = 0; i < length; i++)
 1532            builder.Append((char)random.Int(33, 127));
 33
 334        return builder.ToString();
 35    }
 36}
 37

Methods/Properties

Username()
Password(System.Int32)