private static bool WriteInterfaceContentToken(InjectableType injectableType, string tokenName, StringBuilder builder)
        {
            switch (tokenName)
            {
            case "InterfaceName":
                builder.Append(injectableType.TypeName);
                break;

            case "InterfaceNameBase":
                builder.Append(injectableType.TypeBaseName);
                break;

            case "InterfaceType":
                builder.Append(injectableType.ToString());
                break;

            case "InterfaceMockName":
                builder.Append(injectableType.MockName);
                break;

            default:
                return(false);
            }

            return(true);
        }
示例#2
0
        private static string ReplaceInterfaceTokens(string template, InjectableType injectableType)
        {
            return(StringUtilities.ReplaceTokens(
                       template,
                       (tokenName, propertyIndex, builder) =>
            {
                switch (tokenName)
                {
                case "InterfaceName":
                    builder.Append(injectableType.TypeName);
                    break;

                case "InterfaceNameBase":
                    builder.Append(injectableType.TypeBaseName);
                    break;

                case "InterfaceType":
                    builder.Append(injectableType.ToString());
                    break;

                case "InterfaceMockName":
                    builder.Append(injectableType.MockName);
                    break;

                default:
                    // We didn't recognize it, just pass through.
                    builder.Append($"${tokenName}$");
                    break;
                }
            }));
        }