Ejemplo n.º 1
0
        private async Task StoreInDb()
        {
            var result = new MutationResult
            {
                Coverage = new CodeCoverage
                {
                    Covered   = _cppClass.Coverage?.LinesCovered ?? 0,
                    Uncovered = _cppClass.Coverage?.LinesNotCovered ?? 0
                },
                Key         = _cppClass.Sha256,
                DateCreated = DateTime.UtcNow,
                Mutation    = new Api.Clients.ServiceClients.Mutation
                {
                    Survived = _cppClass.MutationScore.Survived,
                    Killed   = _cppClass.MutationScore.Killed
                },
                NoOfTests = _cppClass.NumberOfTests,
                Source    = _cppClass.SourceClass.GithubPath(),
                Test      = _cppClass.TestClass.GithubPath()
            };

            foreach (var score in _cppClass.MutatorWiseMutationScores)
            {
                result.MutatorWiseMutations.Add(score.Mutator, new Api.Clients.ServiceClients.Mutation
                {
                    Killed   = score.MutationScore.Killed,
                    Survived = score.MutationScore.Survived
                });
            }

            await _client.StoreInDatabaseAsync(result);
        }
Ejemplo n.º 2
0
        private async Task StoreToDb()
        {
            var mutationResult = new MutationResult
            {
                Key         = _source.SHA256,
                Source      = _source.FilePath.GithubPath(),
                Test        = _source.TestClaz.FilePath.GithubPath(),
                NoOfTests   = _source.NumberOfTests,
                DateCreated = DateTime.UtcNow,
                Mutation    = new Mutation
                {
                    Survived = _source.MutationScore.Survived,
                    Killed   = _source.MutationScore.Killed,
                },
                Coverage = new CodeCoverage
                {
                    Covered   = _source.Coverage.LinesCovered,
                    Uncovered = _source.Coverage.LinesNotCovered
                },
                ExternalCoverage = _source.ExternalCoverage
            };

            foreach (var score in _source.MutatorWiseMutationScores)
            {
                mutationResult.MutatorWiseMutations.Add(score.Mutator, new Mutation
                {
                    Survived = score.MutationScore.Survived,
                    Killed   = score.MutationScore.Killed
                });
            }

            if (_source.StoreToDb)
            {
                await _client.StoreInDatabaseAsync(mutationResult);
            }
        }