| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ResxPhoneFakerProvider.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.Contacts; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Provides fake phone datasets from localized RESX resources. |
| | | 16 | | /// </summary> |
| | | 17 | | public sealed class ResxPhoneFakerProvider : ResxProviderBase, IPhoneFakerProvider |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Creates a new instance of the <see cref="ResxPhoneFakerProvider"/> 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="ResxPhoneFakerProvider"/>.</returns> |
| | 6 | 24 | | public static ResxPhoneFakerProvider Create(CultureInfo culture) => new(culture); |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Initializes a new instance of the <see cref="ResxPhoneFakerProvider"/> 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 ResxPhoneFakerProvider(CultureInfo culture) |
| | 6 | 32 | | : base(culture, PatternsResources.ResourceManager) |
| | | 33 | | { |
| | 3 | 34 | | NumberFormats = LoadDataset(nameof(PatternsResources.PhoneNumbers)); |
| | 3 | 35 | | MobileNumberFormats = LoadDataset(nameof(PatternsResources.PhoneMobileNumbers)); |
| | 3 | 36 | | InternationalNumberFormats = LoadDataset(nameof(PatternsResources.PhoneInternationalNumbers)); |
| | 3 | 37 | | } |
| | | 38 | | |
| | | 39 | | /// <inheritdoc /> |
| | | 40 | | public IReadOnlyList<string> NumberFormats { get; } |
| | | 41 | | |
| | | 42 | | /// <inheritdoc /> |
| | | 43 | | public IReadOnlyList<string> MobileNumberFormats { get; } |
| | | 44 | | |
| | | 45 | | /// <inheritdoc /> |
| | | 46 | | public IReadOnlyList<string> InternationalNumberFormats { get; } |
| | | 47 | | } |
| | | 48 | | |