< Summary

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

File(s)

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ResxProviderBase.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Collections.Immutable;
 9using System.Globalization;
 10using System.Resources;
 11using MyNet.Fakers.Localization;
 12using MyNet.Globalization.Localization.Providers;
 13
 14namespace MyNet.Fakers;
 15
 16/// <summary>
 17/// Base class for RESX-based pattern providers. This class provides common functionality for loading localized datasets
 18/// </summary>
 19/// <param name="culture">The culture associated with this provider, used for loading localized datasets from RESX resou
 20/// <param name="resourceManager">The resource manager used to load localized datasets from RESX resources.</param>
 21public abstract class ResxProviderBase(CultureInfo culture, ResourceManager resourceManager) : ICultureScoped
 22{
 23    /// <summary>
 24    /// Gets the culture associated with this provider, used for loading localized datasets from RESX resources.
 25    /// </summary>
 3026    public CultureInfo Culture { get; } = culture ?? throw new ArgumentNullException(nameof(culture));
 27
 28    /// <summary>
 29    /// Gets the resource manager used to load localized datasets from RESX resources. This is typically initialized in 
 30    /// </summary>
 1831    protected ResourceManager ResourceManager { get; } = resourceManager ?? throw new ArgumentNullException(nameof(resou
 32
 33    /// <summary>
 34    /// Loads a localized string list from a RESX resource using the provided key. This method utilizes the <see cref="R
 35    /// </summary>
 36    /// <param name="key">The key of the resource to load.</param>
 37    /// <returns>A read-only list of localized strings.</returns>
 7838    protected ImmutableArray<string> LoadDataset(string key) => ResourceDatasetLoader.LoadList(ResourceManager, key, Cul
 39}
 40