public void InjectionSanity() { MethodInfo targetMethod = AccessTools.Method(typeof(Constructable), "Construct"); List <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(targetMethod); IEnumerable <CodeInstruction> result = Constructable_Construct_Patch.Transpiler(targetMethod, beforeInstructions); Assert.IsTrue(beforeInstructions.Count < PatchTestHelper.GetInstructionCount(result)); }
public void Sanity() { List <CodeInstruction> instructions = PatchTestHelper.GenerateDummyInstructions(100); instructions.Add(new CodeInstruction(Constructable_Construct_Patch.INJECTION_OPCODE, Constructable_Construct_Patch.INJECTION_OPERAND)); IEnumerable <CodeInstruction> result = Constructable_Construct_Patch.Transpiler(null, instructions); Assert.AreEqual(111, PatchTestHelper.GetInstructionCount(result)); }
public void Sanity() { List <CodeInstruction> instructions = PatchTestHelper.GenerateDummyInstructions(100); instructions.Add(new CodeInstruction(Constructable_Construct_Patch.AMOUNT_CHANGED_INJECTION_OPCODE, Constructable_Construct_Patch.AMOUNT_CHANGED_INJECTION_OPERAND)); instructions.Add(new CodeInstruction(Constructable_Construct_Patch.CONSTRUCTION_COMPLETE_INJECTION_OPCODE, Constructable_Construct_Patch.CONSTRUCTION_COMPLETE_INJECTION_OPERAND)); IEnumerable <CodeInstruction> result = Constructable_Construct_Patch.Transpiler(null, instructions); Assert.AreEqual(112, result.Count()); }