/// <summary>
        /// Moves the original assembly aside, and writes the mutated copy in
        /// its place before returning the test meta data  to allow the test
        /// suite to be run.
        /// </summary>
        /// <param name="assembly">
        /// An <see cref="AssemblyDefinition" /> for the containing assembly.
        /// </param>
        /// <param name="method"> </param>
        /// <param name="fileName">
        /// The path to the assembly file, so that the turtle can overwrite it
        /// with mutated versions.
        /// </param>
        /// <param name="output">
        /// The string describing the mutation, returned to calling code with
        /// <c>yield return</c>.
        /// </param>
        /// <returns>
        /// A <see cref="MutationTestMetaData" /> instance.
        /// </returns>
        protected MutationTestMetaData PrepareTests(AssemblyDefinition assembly, MethodDefinition method, string fileName, string output)
        {
            string sourceFolder = Path.GetDirectoryName(fileName);
            string targetFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));

            CopyDirectory(sourceFolder, targetFolder);
            string targetFileName = Path.Combine(targetFolder, Path.GetFileName(fileName));

            assembly.Write(targetFileName);
            var metaData = new MutationTestMetaData
            {
                TestFolder         = targetFolder,
                Description        = output,
                DiffRepresentation = ConstructEstimateCodeDiff(method)
            };

            Monitor.Exit(method);
            return(metaData);
        }
Esempio n. 2
0
 /// <summary>
 /// Moves the original assembly aside, and writes the mutated copy in
 /// its place before returning the test meta data  to allow the test
 /// suite to be run.
 /// </summary>
 /// <param name="assembly">
 /// An <see cref="AssemblyDefinition" /> for the containing assembly.
 /// </param>
 /// <param name="method"> </param>
 /// <param name="fileName">
 /// The path to the assembly file, so that the turtle can overwrite it
 /// with mutated versions.
 /// </param>
 /// <param name="output">
 /// The string describing the mutation, returned to calling code with
 /// <c>yield return</c>.
 /// </param>
 /// <returns>
 /// A <see cref="MutationTestMetaData" /> instance.
 /// </returns>
 protected MutationTestMetaData PrepareTests(AssemblyDefinition assembly, MethodDefinition method, string fileName, string output)
 {
     string sourceFolder = Path.GetDirectoryName(fileName);
     string targetFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
     CopyDirectory(sourceFolder, targetFolder);
     string targetFileName = Path.Combine(targetFolder, Path.GetFileName(fileName));
     assembly.Write(targetFileName);
     var metaData = new MutationTestMetaData
                      {
                          TestFolder = targetFolder,
                          Description = output,
                          DiffRepresentation = ConstructEstimateCodeDiff(method)
                      };
     Monitor.Exit(method);
     return metaData;
 }