public void ReadsParameter_InstanceMethodLdarg1_ReturnsFirstParameter()
        {
            var subject = new InstructionHelper();

            Parameter parameter;
            bool result = subject.ReadsParameter(InstanceMethodReference,
                Instruction.Create(OpCodes.Ldarg_1), out parameter);

            Assert.IsTrue(result);
            Assert.AreEqual(1, parameter.Index);
            Assert.AreEqual(typeof(int).FullName, parameter.ParameterType.FullName);
        }
        public void ReadsParameter_StaticMethodLdarg_ReturnsSpecifiedParameter(
            int parameterIndex, Type expectedType)
        {
            var subject = new InstructionHelper();

            Parameter parameter;
            var instruction = Instruction.Create(OpCodes.Ldarg,
                StaticMethodReference.Parameters[parameterIndex]);
            bool result = subject.ReadsParameter(StaticMethodReference, instruction, out parameter);

            Assert.IsTrue(result);
            Assert.AreEqual(parameterIndex, parameter.Index);
            Assert.AreEqual(expectedType.FullName, parameter.ParameterType.FullName);
        }
        public void ReadsParameter_StaticMethodLdarg3_ReturnsFourthParameter()
        {
            var subject = new InstructionHelper();

            Parameter parameter;
            bool result = subject.ReadsParameter(StaticMethodReference,
                Instruction.Create(OpCodes.Ldarg_3), out parameter);

            Assert.IsTrue(result);
            Assert.AreEqual(3, parameter.Index);
            Assert.AreEqual(typeof(double).FullName, parameter.ParameterType.FullName);
        }