Sha256: f0795b5629fee7328f55ddacfa19745c9d04cd3ee197332ec1844471e2a95974
Contents?: true
Size: 1.09 KB
Versions: 29
Compression:
Stored size: 1.09 KB
Contents
using System; using System.Text.RegularExpressions; using Humanizer; namespace Generators.Output { public static class NameExtensions { public static string ToExerciseName(this Type exerciseType) => exerciseType.Name.Kebaberize(); public static string ToTestClassName(this string input) => $"{input.Dehumanize()}Test"; public static string ToTestedClassName(this string input) => input.Dehumanize(); public static string ToTestMethodName(this string input) { var methodName = Regex.Replace(input.Replace(":", " is"), @"[^\w]+", "_", RegexOptions.Compiled) .Underscore() .Transform(To.TitleCase); if (char.IsDigit(methodName[0])) return "Number_" + methodName; if (!char.IsLetter(methodName[0])) return "Test_"; return methodName; } public static string ToTestedMethodName(this string input) => input.Dehumanize(); public static string ToVariableName(this string input) => input.Camelize(); } }
Version data entries
29 entries across 29 versions & 1 rubygems