예제 #1
0
        private void PersistCorrespondenceModel(Models.CorrespondenceModel model)
        {
            if (!Directory.Exists(CorrespondenceModelsStoragePlace))
            {
                Directory.CreateDirectory(CorrespondenceModelsStoragePlace);
            }

            var artefact = GetFile(model.TestType, model.ProgramVersionId);

            correspondenceModelAdapter.Unparse(model, artefact);
        }
예제 #2
0
 private void UpdateByNewLinks(Models.CorrespondenceModel correspondenceModel, Dictionary <string, HashSet <string> > newLinks)
 {
     foreach (KeyValuePair <string, HashSet <string> > linksForTestcase in newLinks)
     {
         if (!correspondenceModel.CorrespondenceModelLinks.ContainsKey(linksForTestcase.Key))
         {
             correspondenceModel.CorrespondenceModelLinks.Add(linksForTestcase.Key, linksForTestcase.Value);
         }
         else
         {
             correspondenceModel.CorrespondenceModelLinks[linksForTestcase.Key] = linksForTestcase.Value;
         }
     }
 }
예제 #3
0
        private Models.CorrespondenceModel CloneModel(Models.CorrespondenceModel correspondenceModel, string newId)
        {
            var clone = new Dictionary <string, HashSet <string> >();

            foreach (KeyValuePair <string, HashSet <string> > testcaseRelatedElements in correspondenceModel.CorrespondenceModelLinks)
            {
                clone.Add(testcaseRelatedElements.Key, new HashSet <string>(testcaseRelatedElements.Value));
            }

            return(new Models.CorrespondenceModel
            {
                ProgramVersionId = newId,
                CorrespondenceModelLinks = clone,
                TestType = correspondenceModel.TestType
            });
        }
예제 #4
0
        public Models.CorrespondenceModel GetCorrespondenceModel <TTestCase>(TModel programModel, TestsModel <TTestCase> testsModel)
            where TTestCase : ITestCase
        {
            string testType = typeof(TTestCase).Name;
            var    artefact = GetFile(testType, programModel.VersionId);

            var defaultModel = new Models.CorrespondenceModel
            {
                ProgramVersionId = Path.GetFileNameWithoutExtension(artefact.FullName),
                TestType         = testType
            };

            var model = correspondenceModelAdapter.Parse(artefact) ?? defaultModel;

            return(model);
        }
예제 #5
0
 private void RemoveDeletedTests <TTestCase>(Models.CorrespondenceModel correspondenceModel, StructuralDelta <TestsModel <TTestCase>, TTestCase> testsDelta)
     where TTestCase : ITestCase
 {
     testsDelta.DeletedElements.ForEach(x => correspondenceModel.CorrespondenceModelLinks.Remove(x.Id));
 }
예제 #6
0
 private void RemoveFailedTests(Models.CorrespondenceModel correspondenceModel, IEnumerable <string> failedTests)
 {
     failedTests.ForEach(x => correspondenceModel.CorrespondenceModelLinks.Remove(x));
 }