コード例 #1
0
 public InstanceCreatorOptions(IUnitReflector reflector, ILocalVariableBindings locals, ITypeReference type, params ITypeReference[] constructorParameters)
 {
     this.type = type;
     this.locals = locals;
     this.reflector = reflector;
     this.constructorParameters = constructorParameters;
 }
コード例 #2
0
 public SpecifiedMethodCallRegistrar(IMetadataHost host, ILogger log, ReplacementRegistry registry)
 {
     this.host = host;
     this.log = log;
     this.registry = registry;
     reflector = new UnitReflector(host);
 }
コード例 #3
0
        public AnonymousMethodBodyBuilder(IMetadataHost host, IUnitReflector reflector, ITypeReference delegateType, Type returnType, ParameterInfo[] parameters)
        {
            this.host = host;
            this.reflector = reflector;
            this.delegateType = delegateType;

            this.returnTypeReference = reflector.Get(returnType);

            foreach (var parameter in parameters)
            {
                var parameterDefinition = new ParameterDefinition();
                parameterDefinition.Index = (ushort)parameter.Position;
                parameterDefinition.Type = reflector.Get(parameter.ParameterType);
                parameterDefinition.Name = host.NameTable.GetNameFor("altered" + parameter.Name);
                parameterDefinition.ContainingSignature = method;

                method.Parameters.Add(parameterDefinition);
            }
        }
コード例 #4
0
        public AnonymousMethodBodyBuilder(IMetadataHost host, IUnitReflector reflector, ITypeReference delegateType, ITypeReference returnType, KeyValuePair<string, ITypeReference>[] parameterTypes)
        {
            this.host = host;
            this.reflector = reflector;
            this.delegateType = delegateType;
            this.returnTypeReference = returnType;

            for (var pIndex = 0; pIndex < parameterTypes.Length; pIndex++)
            {
                var parameterType = parameterTypes[pIndex];

                var parameterDefinition = new ParameterDefinition();
                parameterDefinition.Index = (ushort) pIndex;
                parameterDefinition.Type = parameterType.Value;
                parameterDefinition.Name = host.NameTable.GetNameFor("altered" + parameterType.Key);
                parameterDefinition.ContainingSignature = method;

                method.Parameters.Add(parameterDefinition);
            }
        }
コード例 #5
0
        public MethodBodyBuilder(IMetadataHost host, IEnumerable<IParameterDefinition> parameters)
        {
            reflector = new UnitReflector(host);
            locals = new LocalVariableBindings(reflector);
            define = new DefinitionBuilder(reflector, locals, host.NameTable);
            create = new InstanceCreator(reflector, locals);
            declare = new DeclarationBuilder(define);
            call = new MethodCallBuilder(host, reflector, locals);
            changeType = new Converter(reflector);
            operators = new TypeOperatorBuilder(reflector);
            constant = new CompileTimeConstantBuilder(reflector);
            @if = new IfStatementBuilder();
            @return = new CodeReturnStatementBuilder();
            anonymousMethod = new AnonymousMethodTypeOptions(host, reflector);
            statement = new StatementBuilder();
            @params = new ParameterBindings();

            foreach (var parameter in parameters)
            {
                @params.AddBinding(parameter);
            }
        }
コード例 #6
0
 public StaticMethodCallReplacer(IMetadataHost host, ILogger log, ReplacementRegistry registry)
 {
     this.log = log;
     this.registry = registry;
     reflector = new UnitReflector(host);
 }
コード例 #7
0
 public TypeOperatorBuilder(IUnitReflector reflector)
 {
     this.reflector = reflector;
 }
コード例 #8
0
ファイル: Converter.cs プロジェクト: jamarchist/SharpMock
 public Converter(IUnitReflector reflector)
 {
     this.reflector = reflector;
 }