Example #1
0
        /// <summary>
        /// Merges two coverage objects together, mutating the current one
        /// </summary>
        /// <param name="coverageData"></param>
        public void Merge(CoverageData coverageData)
        {
            foreach (var pair in coverageData)
            {
                if (this.ContainsKey(pair.Key))
                {
                    this[pair.Key].Merge(pair.Value);
                }
                else
                {
                    this[pair.Key] = new CoverageFileData(pair.Value);
                }
            }

            // Since there could be multiple chutzpah.json files each setting their own success percentage
            // we take the minimum of all of them. In the future, it would be nice to e able to apply each percentage to the
            // test files they came from.
            if (!SuccessPercentage.HasValue)
            {
                SuccessPercentage = coverageData.SuccessPercentage;
            }
            else if (coverageData.SuccessPercentage.HasValue)
            {
                SuccessPercentage = Math.Min(SuccessPercentage.Value, coverageData.SuccessPercentage.Value);
            }
        }
Example #2
0
        internal void AppendCoverageData(CoverageData fileCoverageObject)
        {
            if (fileCoverageObject != null)
            {
                if (CoverageObject == null)
                {
                    CoverageObject = new CoverageData();
                }

                CoverageObject.Merge(fileCoverageObject);
            }
        }