public Task SelectTests(StructuralDelta <TestsModel <TTestCase>, TTestCase> testsDelta, TProgramDelta programDelta,
                                CancellationToken cancellationToken)
        {
            var delta = deltaAdapter.Convert(programDelta);

            CorrespondenceModel = correspondenceModelProvider.GetCorrespondenceModel(delta.OldModel, testsDelta.OldModel);

            ISet <TTestCase> impactedTests = new HashSet <TTestCase>();

            foreach (var testcase in testsDelta.NewModel.TestSuite)
            {
                cancellationToken.ThrowIfCancellationRequested();

                HashSet <string> linkedElements;
                if (CorrespondenceModel.CorrespondenceModelLinks.TryGetValue(testcase.Id, out linkedElements))
                {
                    if (delta.ChangedElements.Any(x => linkedElements.Any(y => x.Id.Equals(y, StringComparison.Ordinal))) ||
                        delta.DeletedElements.Any(x => linkedElements.Any(y => x.Id.Equals(y, StringComparison.Ordinal))))
                    {
                        impactedTests.Add(testcase);
                    }
                }
                else
                {
                    impactedTests.Add(testcase);
                }
            }

            SelectedTests = impactedTests;

            return(Task.CompletedTask);
        }
        public async Task SelectTests(StructuralDelta <TestsModel <TTestCase>, TTestCase> testsDelta, TInputProgramDelta programDelta, CancellationToken cancellationToken)
        {
            var convertedDelta = deltaAdapter.Convert(programDelta);

            var dataStructure = await dataStructureBuilder.GetDataStructure(convertedDelta.NewModel, cancellationToken);

            SelectedTests = staticSelector.SelectTests(dataStructure, testsDelta, convertedDelta, cancellationToken);
        }
Exemple #3
0
        public List <string> GetResponsibleChanges(ICorrespondenceModel correspondenceModel, TTestCase testCase, StructuralDelta <TModel, TModelElement> delta)
        {
            var selectionDelta = deltaAdapter.Convert(delta);

            if (correspondenceModel == null)
            {
                return(new List <string>(new[] { "Responsible changes unkown!" }));
            }

            if (correspondenceModel.CorrespondenceModelLinks.ContainsKey(testCase.Id))
            {
                var linksOfTestcase = correspondenceModel.CorrespondenceModelLinks[testCase.Id];
                return(linksOfTestcase.Where(x => selectionDelta.AddedElements.Any(y => y.Id == x) ||
                                             selectionDelta.ChangedElements.Any(y => y.Id == x) ||
                                             selectionDelta.DeletedElements.Any(y => y.Id == x)).ToList());
            }

            return(new List <string>());
        }
Exemple #4
0
        public TTargetDelta Convert(TSourceDelta deltaToConvert)
        {
            TIntermediateDelta intermediateDelta = firstAdapter.Convert(deltaToConvert);

            return(secondAdapter.Convert(intermediateDelta));
        }