public static void MapTypeName(this ISymbolMap symbols, string fullyQualifiedName, string frameworkName, TypeKind kind)
        {
            var proxyName = $"{frameworkName}Proxy";

            switch (kind)
            {
            case TypeKind.Interface:
                var defaultName = frameworkName;

                symbols
                .GetInterfaceProxyName(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(proxyName);
                symbols
                .GetInterfaceDefaultName(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(defaultName);
                symbols
                .GetInterfaceProxyNameSyntaxToken(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseToken(proxyName));
                symbols
                .GetInterfaceDefaultNameSyntaxToken(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseToken(defaultName));
                symbols
                .GetInterfaceProxyNameSyntax(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseName(proxyName));
                symbols
                .GetInterfaceDefaultNameSyntax(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseName(defaultName));

                frameworkName = $"I{frameworkName}";
                break;

            case TypeKind.Class:
                symbols
                .GetAbstractClassProxyName(Arg.Is <ClassType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(proxyName);
                break;
            }

            symbols
            .GetName(Arg.Is <Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(frameworkName);
            symbols
            .GetName(Arg.Is <string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(frameworkName);
            symbols
            .GetNameSyntaxToken(Arg.Is <Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseToken(frameworkName));
            symbols
            .GetNameSyntaxToken(Arg.Is <string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseToken(frameworkName));
            symbols
            .GetNameSyntax(Arg.Is <Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseName(frameworkName));
            symbols
            .GetNameSyntax(Arg.Is <string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseName(frameworkName));
            symbols
            .GetTypeSyntax(Arg.Is <TypeReference>(t => t.FullyQualifiedName == fullyQualifiedName), false)
            .Returns(SF.ParseTypeName(frameworkName));
        }
Esempio n. 2
0
        public static void MapTypeName(this ISymbolMap symbols, string fullyQualifiedName, string frameworkName, TypeKind kind)
        {
            if (kind == TypeKind.Interface)
            {
                string proxyName   = $"{frameworkName}Proxy";
                string defaultName = frameworkName;

                symbols
                .GetInterfaceProxyName(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(proxyName);
                symbols
                .GetInterfaceDefaultName(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(defaultName);
                symbols
                .GetInterfaceProxyNameSyntaxToken(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseToken(proxyName));
                symbols
                .GetInterfaceDefaultNameSyntaxToken(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseToken(defaultName));
                symbols
                .GetInterfaceProxyNameSyntax(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseName(proxyName));
                symbols
                .GetInterfaceDefaultNameSyntax(Arg.Is <InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
                .Returns(SF.ParseName(defaultName));

                frameworkName = $"I{frameworkName}";
            }

            symbols
            .GetName(Arg.Is <Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(frameworkName);
            symbols
            .GetName(Arg.Is <string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(frameworkName);
            symbols
            .GetNameSyntaxToken(Arg.Is <Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseToken(frameworkName));
            symbols
            .GetNameSyntaxToken(Arg.Is <string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseToken(frameworkName));
            symbols
            .GetNameSyntax(Arg.Is <Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseName(frameworkName));
            symbols
            .GetNameSyntax(Arg.Is <string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any <bool>())
            .Returns(SF.ParseName(frameworkName));
            symbols
            .GetTypeSyntax(Arg.Is <TypeReference>(t => t.FullyQualifiedName == fullyQualifiedName))
            .Returns(SF.ParseTypeName(frameworkName));
        }