public void VisitInlineArg_UShortArgument_EmitsInstruction() { ParameterDefinition parameter = TestDataFactory.CreateParameterDefinition(256); _generatorMock .Setup(generator => generator.Emit(System.Reflection.Emit.OpCodes.Ldarg, parameter.Index)) .Verifiable(); var subject = new ILGeneratorInstructionVisitor(_generatorMock.Object); var instruction = Instruction.Create(OpCodes.Ldarg, parameter); subject.VisitInlineArg(instruction, parameter); _generatorMock.Verify(); }
public void VisitInlineArg_ByteArgument_EmitsInstruction() { var method = CecilUtility.Import(ReflectionUtility.GetMethod(() => int.Parse(string.Empty))).Resolve(); ParameterDefinition parameter = method.Parameters[0]; _generatorMock .Setup(generator => generator.Emit(System.Reflection.Emit.OpCodes.Ldarg_S, (byte)parameter.Index)) .Verifiable(); var subject = new ILGeneratorInstructionVisitor(_generatorMock.Object); var instruction = Instruction.Create(OpCodes.Ldarg_S, parameter); subject.VisitInlineArg(instruction, parameter); _generatorMock.Verify(); }