public void TranspilerPatch_ShouldFindOnePatternOnly()
        {
            DisableWieldedWeaponAnimationWhenThePlayerIsDead defaultPatch = CreateDefaultPatch();
            MethodInfo patchedMethod = defaultPatch.GetPatchMethodsInfo().ElementAt(0).PatchedMethod;
            MethodInfo patchMethod   = defaultPatch.GetPatchMethodsInfo().ElementAt(0).PatchMethod;

            CodeInstructionDifference codeInstructionDifference = TranspilerPatchHelper.CodeInstructionDifferencesBetweenOriginalAndTranspiledMethod(
                defaultPatch,
                patchedMethod,
                patchMethod
                );

            Assert.AreEqual(2, codeInstructionDifference.InsertedCodeInstructions.Count());
            Assert.AreEqual(0, codeInstructionDifference.RemovedCodeInstructions.Count());
        }
Beispiel #2
0
        public void TranspilerPatch_ShouldFindOnePatternOnly()
        {
            DisableDelegateFormationsToAiWhenPlayerDies defaultPatch = CreateDefaultPatch();
            MethodInfo patchedMethod = defaultPatch.GetPatchMethodsInfo().ElementAt(0).PatchedMethod;
            MethodInfo patchMethod   = defaultPatch.GetPatchMethodsInfo().ElementAt(0).PatchMethod;

            CodeInstructionDifference codeInstructionDifference = TranspilerPatchHelper.CodeInstructionDifferencesBetweenOriginalAndTranspiledMethod(
                defaultPatch,
                patchedMethod,
                patchMethod
                );

            Assert.AreEqual(3, codeInstructionDifference.RemovedCodeInstructions.Count());
            Assert.AreEqual(0, codeInstructionDifference.InsertedCodeInstructions.Count());
        }
        public void TranspilerPatch_ShouldFindOnePatternOnly()
        {
            PreventCrashWhenOrderingFormationToFaceEnemy defaultPatch = CreateDefaultPatch();
            MethodInfo patchedMethod = defaultPatch.GetPatchMethodsInfo().ElementAt(0).PatchedMethod;
            MethodInfo patchMethod   = defaultPatch.GetPatchMethodsInfo().ElementAt(0).PatchMethod;

            CodeInstructionDifference codeInstructionDifference = TranspilerPatchHelper.CodeInstructionDifferencesBetweenOriginalAndTranspiledMethod(
                defaultPatch,
                patchedMethod,
                patchMethod
                );

            Assert.AreEqual(2, codeInstructionDifference.InsertedCodeInstructions.Count());
            Assert.AreEqual(4, codeInstructionDifference.RemovedCodeInstructions.Count());
        }