public void DoMutate_Returns_Correct_Sequences_With_Fields()
        {
            var module = new Module(Assembly.GetExecutingAssembly().Location);
            module.LoadDebugInformation();
            var method = module.Definition
                .Types.Single(t => t.Name == "VariableWriteClassUnderTest")
                .Methods.Single(t => t.Name == "AddWithPointlessNonsenseViaFields");

            var mutator = new VariableWriteTurtle();
            IList<MutantMetaData> mutations = mutator
                .Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).ToList();

            Assert.AreEqual(2, mutations.Count);
            StringAssert.EndsWith("write substitution Int32._pointlessA => Int32.CS$1$0000", mutations[0].Description);
            StringAssert.EndsWith("write substitution Int32._pointlessB => Int32.CS$1$0000", mutations[1].Description);
        }
        public void DoMutate_Returns_No_Results_As_Appropriate()
        {
            var module = new Module(Assembly.GetExecutingAssembly().Location);
            module.LoadDebugInformation();
            var method = module.Definition
                .Types.Single(t => t.Name == "VariableWriteClassUnderTest")
                .Methods.Single(t => t.Name == "AddWithoutPointlessNonsense");

            var mutator = new VariableWriteTurtle();
            IList<MutantMetaData> mutations = mutator
                .Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).ToList();

            Assert.AreEqual(0, mutations.Count);
        }
        public void DoMutate_Skips_Writes_In_Dispose()
        {
            var assembly = CreateTestAssembly();

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

            var method = module.Definition
                .Types.Single(t => t.Name == "TestClass")
                .Methods.Single(t => t.Name == "TestMethod");

            var mutator = new VariableWriteTurtle();
            IList<MutantMetaData> mutations = mutator
                .Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).ToList();

            Assert.AreEqual(1, mutations.Count);
            string expectedMessage = string.Format(
                "{0:x4}: write substitution Int32. => Int32.",
                _mutatedInstruction.Offset);
            StringAssert.EndsWith(expectedMessage, mutations[0].Description);
        }