public void DisableCoverageInEditor()
 {
     var data = new ExtensionDataModel(this.service, this.vshelper, null, null);
     var sourceCoverage = new SourceCoverage();
     data.CoverageInEditorEnabled = false;
     Assert.IsFalse(data.CoverageInEditorEnabled);
     Assert.AreNotEqual(sourceCoverage, data.GetCoverageInEditor(string.Empty));
 }
        /// <summary>
        /// The update coverage DataCache.
        /// </summary>
        /// <param name="elem">
        /// The elem.
        /// </param>
        /// <param name="coverageData">
        /// The coverage DataCache.
        /// </param>
        private void UpdateCoverageData(EditorData elem, SourceCoverage coverageData)
        {
            if (coverageData == null)
            {
                return;
            }

            var tempCoverageLine = new Dictionary<int, CoverageElement>();

            foreach (LineCoverage linemeasure in coverageData.LinesHits)
            {
                int line = linemeasure.Id - 1;

                tempCoverageLine.Add(line, linemeasure.Hits > 0 ? CoverageElement.LineCovered : CoverageElement.LineNotCovered);
            }

            foreach (BranchCoverage branchmeasure in coverageData.BranchHits)
            {
                int line = branchmeasure.Id - 1;

                if (tempCoverageLine.ContainsKey(line))
                {
                    if (branchmeasure.CoveredConditions == branchmeasure.TotalConditions)
                    {
                        tempCoverageLine[line] = CoverageElement.LineCovered;
                    }
                    else if (branchmeasure.CoveredConditions == 0)
                    {
                        tempCoverageLine[line] = CoverageElement.LineNotCovered;
                    }
                    else
                    {
                        tempCoverageLine[line] = CoverageElement.LinePartialCovered;
                    }
                }
                else
                {
                    if (branchmeasure.CoveredConditions == branchmeasure.TotalConditions)
                    {
                        tempCoverageLine.Add(line, CoverageElement.LineCovered);
                    }
                    else if (branchmeasure.CoveredConditions == 0)
                    {
                        tempCoverageLine.Add(line, CoverageElement.LineNotCovered);
                    }
                    else
                    {
                        tempCoverageLine.Add(line, CoverageElement.LinePartialCovered);
                    }
                }
            }

            elem.CoverageData = tempCoverageLine;
        }
        /// <summary>
        /// The update coverage DataCache.
        /// </summary>
        /// <param name="resource">
        /// The resource.
        /// </param>
        /// <param name="coverageData">
        /// The coverage DataCache.
        /// </param>
        /// <param name="issues">
        /// The issues.
        /// </param>
        /// <param name="serverSource">
        /// The server source.
        /// </param>
        public void UpdateResourceData(Resource resource, SourceCoverage coverageData, List<Issue> issues, string serverSource)
        {
            if (!DataCache.ContainsKey(resource.Key))
            {
                DataCache.Add(resource.Key, new EditorData(resource));
            }

            EditorData elem = DataCache[resource.Key];
            elem.ServerSource = serverSource;
            this.UpdateCoverageData(elem, coverageData);
            this.UpdateIssuesData(elem, issues);
        }