Esempio n. 1
0
        private async Task MergeCodeCoverageFilesAsync(IList <string> files, CancellationToken cancellationToken)
        {
            var coverageUtility = new CoverageFileUtility();

            var coverageData = await coverageUtility.MergeCoverageFilesAsync(
                files,
                cancellationToken).ConfigureAwait(false);

            coverageUtility.WriteCoverageFile(files[0], coverageData);
        }
        private async Task <string> MergeCodeCoverageFilesAsync(IList <string> files, CancellationToken cancellationToken)
        {
            var coverageUtility = new CoverageFileUtility();

            var coverageData = await coverageUtility.MergeCoverageFilesAsync(
                files,
                cancellationToken).ConfigureAwait(false);

            coverageUtility.WriteCoverageFile(files[0], coverageData);

            foreach (var file in files.Skip(1))
            {
                try
                {
                    File.Delete(file);
                }
                catch (Exception ex)
                {
                    EqtTrace.Error($"CodeCoverageDataCollectorAttachmentsHandler: Failed to remove {file}. Error: {ex}");
                }
            }

            return(files[0]);
        }