Sha256: dd1c75b78682e0856f69da20088689d4cbaeaf38fc9dbd4678e184297d85a0b5

Contents?: true

Size: 596 Bytes

Versions: 78

Compression:

Stored size: 596 Bytes

Contents

using System.Text.RegularExpressions;
using Humanizer;

namespace Generators.Methods
{
    public class TestMethodNameTransformer : IStringTransformer
    {
        public string Transform(string input)
        {
            var methodName = Regex.Replace(input, @"[^\w]+", "_", RegexOptions.Compiled)
                .Underscore()
                .Transform(To.TitleCase);

            if (char.IsDigit(methodName[0]))
                return "Number_" + methodName;

            if (!char.IsLetter(methodName[0]))
                return "Test_";

            return methodName;
        }
    }
}

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
trackler-2.1.0.48 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.47 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.46 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.45 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.44 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.43 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.42 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.41 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.40 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.39 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.38 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.37 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.36 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.34 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.33 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.32 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.31 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.30 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.29 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs
trackler-2.1.0.28 tracks/csharp/generators/Methods/TestMethodNameTransformer.cs