コード例 #1
0
        public void PresentCode(CodeWithDifference codeWithDifference)
        {
            var       document = codeTextBox.Document;
            TextRange range    = new TextRange(document.ContentStart, document.ContentEnd);

            range.Text = codeWithDifference.Code;

            foreach (var lineChange in codeWithDifference.LineChanges)
            {
                Color color = lineChange.ChangeType == LineChangeType.Add ? Colors.GreenYellow : Colors.PaleVioletRed;

                HighlightRow(document, lineChange.Text, color);
            }
        }
コード例 #2
0
        public void PresentCode(CodeWithDifference codeWithDifference)
        {
            var document = codeTextBox.Document;
            TextRange range = new TextRange(document.ContentStart, document.ContentEnd);
            range.Text = codeWithDifference.Code;

            foreach (var lineChange in codeWithDifference.LineChanges)
            {
                Color color = lineChange.ChangeType == LineChangeType.Add ? Colors.GreenYellow : Colors.PaleVioletRed;

                HighlightRow(document, lineChange.Text, color);
            }

        }
コード例 #3
0
        public async void LoadCode(CodeLanguage selectedLanguage)
        {
            _viewModel.IsCodeLoading = true;
            _viewModel.ClearCode();

            var mutant = _currentMutant;

            if (mutant != null)
            {
                MutationResult mutationResult = await _mutantsCache.GetMutatedModulesAsync(mutant);

                CodeWithDifference diff = await _codeVisualizer.CreateDifferenceListing(selectedLanguage,
                                                                                        mutant, mutationResult);

                if (diff != null)
                {
                    _viewModel.PresentCode(diff);
                    _viewModel.IsCodeLoading = false;
                }
            }
        }
コード例 #4
0
        public void IntegrationTestMutation()
        {
            var cci = new CciModuleSource(TestProjects.MiscUtil);

            var original = new OriginalCodebase(cci.InList());
            var type     =
                cci.Modules.Single().Module.GetAllTypes().Single(t => t.Name.Value == "Adler32") as NamedTypeDefinition;
            var method  = type.Methods.First(m => m.Name.Value == "ComputeChecksum");
            var choices = new MutationSessionChoices
            {
                Filter = new MutationFilter(
                    new List <TypeIdentifier>(),
                    new MethodIdentifier(method).InList()),
                SelectedOperators = new LOR_LogicalOperatorReplacement().InList <IMutationOperator>(),
            };

            var exec      = new MutationExecutor(new OptionsModel(), choices, null);
            var container = new MutantsContainer(exec, original, new OptionsModel());
            IList <AssemblyNode> assemblies = container.InitMutantsForOperators(ProgressCounter.Inactive());

            var mutants = assemblies.Cast <CheckedNode>()
                          .SelectManyRecursive(n => n.Children ?? new NotifyingCollection <CheckedNode>())
                          .OfType <Mutant>();

            var diff = new CodeDifferenceCreator();
            var vis  = new CodeVisualizer(original, diff);

            foreach (var mutant in mutants)
            {
                var                copy              = new CciModuleSource(TestProjects.MiscUtil);
                MutationResult     result            = exec.ExecuteMutation(mutant, copy).Result;
                CodeWithDifference differenceListing =
                    vis.CreateDifferenceListing(CodeLanguage.CSharp, mutant, result).Result;
                differenceListing.LineChanges.Count.ShouldEqual(2);
            }
        }
コード例 #5
0
 public void PresentCode(CodeWithDifference codeWithDifference)
 {
     View.PresentCode(codeWithDifference);
 }