예제 #1
0
    public static string GetUniqueTestName(string className, MethodInfo method, IReadOnlyList <object?>?parameterValues)
    {
        var name = $"{className}.{method.Name}";

        if (parameterValues == null || !parameterValues.Any())
        {
            return(name);
        }

        var builder    = new StringBuilder();
        var parameters = method.GetParameters();

        for (var index = 0; index < parameters.Length; index++)
        {
            var parameter      = parameters[index];
            var parameterValue = parameterValues[index];
            builder.Append($"{parameter.Name}=");
            if (parameterValue == null)
            {
                builder.Append("null_");
                continue;
            }

            builder.Append($"{VerifierSettings.GetNameForParameter(parameterValue)}_");
        }

        builder.Length -= 1;

        return($"{name}_{builder}");
    }
예제 #2
0
    public static string Concat(MethodInfo method, IReadOnlyList <object?> parameterValues)
    {
        var builder    = new StringBuilder();
        var parameters = method.GetParameters();

        for (var index = 0; index < parameters.Length; index++)
        {
            var parameter = parameters[index];
            var value     = parameterValues[index];
            builder.Append($"{parameter.Name}=");
            if (value == null)
            {
                builder.Append("null_");
                continue;
            }

            builder.Append($"{VerifierSettings.GetNameForParameter(value)}_");
        }

        builder.Length -= 1;

        return(builder.ToString());
    }