Exemple #1
0
    public void InjectionSanity()
    {
        ReadOnlyCollection <CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(CyclopsSonarButton_Update_Patch.TARGET_METHOD);
        IEnumerable <CodeInstruction>        result             = CyclopsSonarButton_Update_Patch.Transpiler(CyclopsSonarButton_Update_Patch.TARGET_METHOD, beforeInstructions);

        Assert.IsTrue(beforeInstructions.Count < result.Count());
    }
Exemple #2
0
    public void Sanity()
    {
        List <CodeInstruction> instructions = PatchTestHelper.GenerateDummyInstructions(100);

        instructions.Add(new CodeInstruction(CyclopsSonarButton_Update_Patch.INJECTION_OPCODE, CyclopsSonarButton_Update_Patch.INJECTION_OPERAND));
        instructions.Add(new CodeInstruction(OpCodes.Callvirt, Reflect.Method((Player player) => player.GetMode())));
        instructions.Add(new CodeInstruction(OpCodes.Brtrue));

        IEnumerable <CodeInstruction> result = CyclopsSonarButton_Update_Patch.Transpiler(null, instructions);

        Assert.AreEqual(instructions.Count + 2, result.Count());
    }