< Summary

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

File(s)

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="PatternFakerExtensions.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System.Collections.Generic;
 8using MyNet.Generator;
 9using MyNet.Text.Randomize;
 10
 11#pragma warning disable IDE0130 // Namespace does not match folder structure
 12namespace MyNet.Fakers;
 13#pragma warning restore IDE0130 // Namespace does not match folder structure
 14
 15public static class PatternFakerExtensions
 16{
 17    extension(ITextRandomGenerator random)
 18    {
 19        /// <summary>
 20        /// Generates a random string based on a randomly selected pattern from the provided list, using the specified t
 21        /// </summary>
 22        /// <param name="generator">The random generator used to select a pattern from the list.</param>
 23        /// <param name="patterns">The list of patterns to choose from.</param>
 24        /// <returns>A randomly generated string based on the selected pattern.</returns>
 25        public string RandomizeWithRandomPattern(IRandomGenerator generator, IReadOnlyList<string> patterns)
 26        {
 1827            var pattern = generator.Item(patterns);
 28
 1829            return random.Randomize(pattern);
 30        }
 31    }
 32}
 33