public void DoMutate_Returns_Correct_Replacements_For_Or()
        {
            var assembly = CreateTestAssembly(OpCodes.Or);

            var addMethod = assembly.MainModule
                .Types.Single(t => t.Name == "TestClass")
                .Methods.Single(t => t.Name == "TestMethod");

            string tempAssemblyFileName = GetTempAssemblyFileName();
            assembly.Write(tempAssemblyFileName);
            var module = new Module(tempAssemblyFileName);

            var mutator = new BitwiseOperatorTurtle();
            IEnumerable<MutantMetaData> mutations = mutator
                .Mutate(addMethod, module, addMethod.Body.Instructions.Select(i => i.Offset).ToArray());

            int and = 0;
            int xor = 0;
            int total = 0;
            foreach (var metaData in mutations)
            {
                total++;
                if (metaData.MethodDefinition.Body.Instructions.Any(i => i.OpCode == OpCodes.And)) and++;
                if (metaData.MethodDefinition.Body.Instructions.Any(i => i.OpCode == OpCodes.Xor)) xor++;
            }

            Assert.AreEqual(2, total);
            Assert.AreEqual(1, and);
            Assert.AreEqual(1, xor);
        }
        public void DoMutate_Returns_Correct_Replacements_For_Xor_And_Describes_Appropriately()
        {
            var assembly = CreateTestAssembly(OpCodes.Xor);

            var divideMethod = assembly.MainModule
                .Types.Single(t => t.Name == "TestClass")
                .Methods.Single(t => t.Name == "TestMethod");

            string tempAssemblyFileName = GetTempAssemblyFileName();
            assembly.Write(tempAssemblyFileName);
            var module = new Module(tempAssemblyFileName);

            var mutator = new BitwiseOperatorTurtle();
            IEnumerable<MutantMetaData> mutations = mutator
                .Mutate(divideMethod, module, divideMethod.Body.Instructions.Select(i => i.Offset).ToArray());

            int or = 0;
            int and = 0;
            int total = 0;
            foreach (var metaData in mutations)
            {
                total++;
                or += MatchReplacement(metaData, OpCodes.Xor, OpCodes.Or);
                and += MatchReplacement(metaData, OpCodes.Xor, OpCodes.And);
            }

            Assert.AreEqual(2, total);
            Assert.AreEqual(1, or);
            Assert.AreEqual(1, and);
        }