< Summary

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

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Create(...)100%11100%
.ctor(...)100%11100%

File(s)

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ResxNameFakerProvider.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Collections.Generic;
 9using System.Globalization;
 10using MyNet.Fakers.Localization;
 11
 12namespace MyNet.Fakers.Identity;
 13
 14/// <summary>
 15/// Provides fake name datasets from localized RESX resources.
 16/// </summary>
 17public sealed class ResxNameFakerProvider : ResxProviderBase, INameFakerProvider
 18{
 19    /// <summary>
 20    /// Creates a new instance of the <see cref="ResxNameFakerProvider"/> class for the specified culture.
 21    /// </summary>
 22    /// <param name="culture">The culture associated with the provider.</param>
 23    /// <returns>A new instance of <see cref="ResxNameFakerProvider"/>.</returns>
 1224    public static ResxNameFakerProvider Create(CultureInfo culture) => new(culture);
 25
 26    /// <summary>
 27    /// Initializes a new instance of the <see cref="ResxNameFakerProvider"/> class with the specified culture.
 28    /// </summary>
 29    /// <param name="culture">The culture associated with the provider.</param>
 30    /// <exception cref="ArgumentNullException">Thrown when the <paramref name="culture"/> is null.</exception>
 31    private ResxNameFakerProvider(CultureInfo culture)
 1232    : base(culture, NamesResources.ResourceManager)
 33    {
 934        MaleFirstNames = LoadDataset(nameof(NamesResources.MaleFirstNames));
 935        FemaleFirstNames = LoadDataset(nameof(NamesResources.FemaleFirstNames));
 936        LastNames = LoadDataset(nameof(NamesResources.LastNames));
 937        Prefixes = LoadDataset(nameof(NamesResources.Prefixes));
 938        Suffixes = LoadDataset(nameof(NamesResources.Suffixes));
 939    }
 40
 41    /// <inheritdoc />
 42    public IReadOnlyList<string> MaleFirstNames { get; }
 43
 44    /// <inheritdoc />
 45    public IReadOnlyList<string> FemaleFirstNames { get; }
 46
 47    /// <inheritdoc />
 48    public IReadOnlyList<string> LastNames { get; }
 49
 50    /// <inheritdoc />
 51    public IReadOnlyList<string> Prefixes { get; }
 52
 53    /// <inheritdoc />
 54    public IReadOnlyList<string> Suffixes { get; }
 55}
 56