import type * as ts from 'typescript' ; import { MockDefiner } from '../../mockDefiner/mockDefiner' ; import { ModuleName } from '../../mockDefiner/modules/moduleName' ; import { TypescriptHelper } from '../helper/helper' ; import { createArrowFunction , createBlock , createCall , createIdentifier , createPropertyAccess , createReturnStatement , createStringLiteral , } from '../../../typescriptFactory/typescriptFactory' ; export function GetMethodDescriptor ( propertyName , returnValue ) { const providerGetMethod = CreateProviderGetMethod ( ) ; const propertyNameString = TypescriptHelper . GetStringPropertyName ( propertyName ) ; const propertyNameStringLiteral = createStringLiteral ( propertyNameString ) ; const propertyValueFunction = createArrowFunction ( createBlock ( [ createReturnStatement ( returnValue ) ] , true ) ) ; return createCall ( providerGetMethod , [ propertyNameStringLiteral , propertyValueFunction , ] ) ; } function CreateProviderGetMethod ( ) { return createPropertyAccess ( createPropertyAccess ( createPropertyAccess ( MockDefiner . instance . getCurrentModuleIdentifier ( ModuleName . Extension ) , createIdentifier ( 'Provider' ) ) , createIdentifier ( 'instance' ) ) , createIdentifier ( 'getMethod' ) ) ; }