Sha256: 10f1dc38904f5adc68a3ba72d36217c278c9b1619e4f83df07d2e85f04f4cae2
Contents?: true
Size: 1.12 KB
Versions: 50
Compression:
Stored size: 1.12 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 = input .Replace(":", " is") .Replace("'", ""); methodName = Regex.Replace(methodName, @"[^\w]+", "_", RegexOptions.Compiled) .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
50 entries across 50 versions & 1 rubygems