예제 #1
0
        private bool BuildAndRunMutationTest(MutationTest mutationTest)
        {
            var outputOption = Options.Options.OfType <Output>().FirstOrDefault();

            if (outputOption != null)
            {
                string outputPath = Path.Combine(Environment.CurrentDirectory, outputOption.FileName);
                mutationTest.MergeReportTo(outputPath);
            }
            var turtlesOption = Options.Options.OfType <TurtlesTypes>().FirstOrDefault();

            if (turtlesOption != null)
            {
                mutationTest.With(turtlesOption.Types);
            }
            bool result = false;

            try
            {
                mutationTest.Run(Options.Options.Any(o => o is DetachBench));
                result = true;
            }
            catch (MutationTestFailureException)
            {
            }
            catch (Exception ex)
            {
                System.Console.Error.WriteLine("An error occur during mutation test of {0}:\n{1}\nThe corresponding report was not merged", mutationTest.TargetMethod, ex);
                return(false);
            }
            _report.MergeMutationTestReport(mutationTest.Report);
            return(result);
        }