< Summary

Information
Class: MyNet.Fakers.Geography.ResxAddressFakerProvider
Assembly: MyNet.Fakers
File(s): https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.Fakers/Geography/ResxAddressFakerProvider.cs
Tag: 342_31701152804
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 60
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/Geography/ResxAddressFakerProvider.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ResxAddressFakerProvider.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.Geography;
 13
 14/// <summary>
 15/// Provides fake address datasets from localized RESX resources.
 16/// </summary>
 17public sealed class ResxAddressFakerProvider : ResxProviderBase, IAddressFakerProvider
 18{
 19    /// <summary>
 20    /// Creates a new instance of the <see cref="ResxAddressFakerProvider"/> 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="ResxAddressFakerProvider"/>.</returns>
 624    public static ResxAddressFakerProvider Create(CultureInfo culture) => new(culture);
 25
 26    /// <summary>
 27    /// Initializes a new instance of the <see cref="ResxAddressFakerProvider"/> 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 ResxAddressFakerProvider(CultureInfo culture)
 632        : base(culture, AddressResources.ResourceManager)
 33    {
 334        StreetTypes = LoadDataset(nameof(AddressResources.StreetTypes));
 335        StreetSuffixes = LoadDataset(nameof(AddressResources.StreetSuffixes));
 336        StreetNames = LoadDataset(nameof(AddressResources.StreetNames));
 337        StreetFormats = LoadDataset(nameof(AddressResources.StreetFormats));
 338        Cities = LoadDataset(nameof(AddressResources.Cities));
 339        PostalCodeFormats = LoadDataset(nameof(AddressResources.PostalCodeFormats));
 340    }
 41
 42    /// <inheritdoc />
 43    public IReadOnlyList<string> StreetTypes { get; }
 44
 45    /// <inheritdoc />
 46    public IReadOnlyList<string> StreetNames { get; }
 47
 48    /// <inheritdoc />
 49    public IReadOnlyList<string> StreetFormats { get; }
 50
 51    /// <inheritdoc />
 52    public IReadOnlyList<string> StreetSuffixes { get; }
 53
 54    /// <inheritdoc />
 55    public IReadOnlyList<string> Cities { get; }
 56
 57    /// <inheritdoc />
 58    public IReadOnlyList<string> PostalCodeFormats { get; }
 59}
 60