| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ResxDomainFakerProvider.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | using System.Collections.Generic; |
| | | 9 | | using System.Globalization; |
| | | 10 | | using MyNet.Fakers.Localization; |
| | | 11 | | |
| | | 12 | | namespace MyNet.Fakers.Internet; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Provides fake domain datasets from localized RESX resources. |
| | | 16 | | /// </summary> |
| | | 17 | | public sealed class ResxDomainFakerProvider : ResxProviderBase, IDomainFakerProvider |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Creates a new instance of the <see cref="ResxDomainFakerProvider"/> 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="ResxDomainFakerProvider"/>.</returns> |
| | 6 | 24 | | public static ResxDomainFakerProvider Create(CultureInfo culture) => new(culture); |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Initializes a new instance of the <see cref="ResxDomainFakerProvider"/> 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 ResxDomainFakerProvider(CultureInfo culture) |
| | 6 | 32 | | : base(culture, DomainsResources.ResourceManager) |
| | | 33 | | { |
| | 3 | 34 | | Domains = LoadDataset(nameof(DomainsResources.Domains)); |
| | 3 | 35 | | Hosts = LoadDataset(nameof(DomainsResources.Hosts)); |
| | 3 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <inheritdoc /> |
| | | 39 | | public IReadOnlyList<string> Domains { get; } |
| | | 40 | | |
| | | 41 | | /// <inheritdoc /> |
| | | 42 | | public IReadOnlyList<string> Hosts { get; } |
| | | 43 | | } |
| | | 44 | | |