Пример #1
0
        private static string GetMapping(ParameterMapping mapping, bool filterRequired = false)
        {
            string inputPath = mapping.InputParameter.Name;

            if (mapping.InputParameterProperty != null)
            {
                inputPath += "." + CodeNamer.CamelCase(mapping.InputParameterProperty) + "()";
            }
            if (filterRequired && !mapping.InputParameter.IsRequired)
            {
                inputPath = "null";
            }

            string outputPath = "";

            if (mapping.OutputParameterProperty != null)
            {
                outputPath += ".with" + CodeNamer.PascalCase(mapping.OutputParameterProperty);
                return(string.Format(CultureInfo.InvariantCulture, "{0}({1})", outputPath, inputPath));
            }
            else
            {
                return(string.Format(CultureInfo.InvariantCulture, "{0} = {1}", outputPath, inputPath));
            }
        }
Пример #2
0
            private static string CreateSignature(IEnumerable <ConstructorParameterModel> parameters)
            {
                var declarations = new List <string>();

                foreach (var property in parameters.Select(p => p.UnderlyingProperty))
                {
                    string format = (property.IsRequired ? "{0} {1}" : "{0} {1} = default({0})");
                    declarations.Add(string.Format(CultureInfo.InvariantCulture,
                                                   format, property.Type, CodeNamer.CamelCase(property.Name)));
                }

                return(string.Join(", ", declarations));
            }
Пример #3
0
        public void CamelCase(string expected, string value)
        {
            var result = CodeNamer.CamelCase(value);

            Assert.Equal(expected, result);
        }
Пример #4
0
 /// <summary>
 /// Converts the specified string to a camel cased string.
 /// </summary>
 /// <param name="value">The string to convert.</param>
 /// <returns>The camel case string.</returns>
 public static string ToCamelCase(this string value)
 {
     return(CodeNamer.CamelCase(value));
 }