Sha256: f22c26bc153e37f46edf3f236a680f81d8fe6e9091ad5b0a2a72255071943147
Contents?: true
Size: 1.21 KB
Versions: 114
Compression:
Stored size: 1.21 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.ToExerciseName(); public static string ToExerciseName(this string input) => input.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
114 entries across 114 versions & 1 rubygems