当前位置: 首页>>代码示例>>C#>>正文


C# SourceRepository.GetCodeCoverageStringTextSource方法代码示例

本文整理汇总了C#中SourceRepository.GetCodeCoverageStringTextSource方法的典型用法代码示例。如果您正苦于以下问题:C# SourceRepository.GetCodeCoverageStringTextSource方法的具体用法?C# SourceRepository.GetCodeCoverageStringTextSource怎么用?C# SourceRepository.GetCodeCoverageStringTextSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SourceRepository的用法示例。


在下文中一共展示了SourceRepository.GetCodeCoverageStringTextSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransformSequences_RemoveFalsePositiveUnvisited

        private static void TransformSequences_RemoveFalsePositiveUnvisited (IEnumerable<Method> methods, SourceRepository sourceRepository, DateTime moduleTime)
        {
            var sequencePointsSet = new HashSet<SequencePoint>(new SequencePointComparer());
            var toRemoveMethodSequencePoint = new List<Tuple<Method, SequencePoint>>();

            // Initialise sequencePointsSet
            TransformSequences_RemoveFalsePositiveUnvisited(methods, sequencePointsSet);

            // Check generated methods
            foreach (var method in methods
                     .Where (m => m.FileRefUniqueId != 0
                             && m.SequencePoints.Length != 0
                             && m.IsGenerated)) {

                // Select duplicate and false-positive unvisited sequence points
                // (Sequence point duplicated by generated method and left unvisited)
                foreach (var sp in method.SequencePoints
                         .Where (sp => sp.FileId == method.FileRefUniqueId
                                 && sp.VisitCount == 0) ) {
    
                    if (sequencePointsSet.Contains(sp)) {
                        // Unvisited duplicate found, add to remove list
                        toRemoveMethodSequencePoint.Add (new Tuple<Method, SequencePoint>(method, sp));
                    }
                }
    
                // Get method source if availabile 
                var source = sourceRepository.GetCodeCoverageStringTextSource(method.FileRefUniqueId);
                if (source != null && !source.IsChanged(moduleTime)) {
                    TransformSequences_RemoveFalsePositiveUnvisited (method, source, toRemoveMethodSequencePoint);
                }

            }

            // Remove selected SequencePoints
            foreach (var tuple in toRemoveMethodSequencePoint) {
                tuple.Item1.SequencePoints = tuple.Item1.SequencePoints.Where(sp => sp != tuple.Item2).ToArray();
            }
        }
开发者ID:AtwooTM,项目名称:opencover,代码行数:39,代码来源:BasePersistance.cs

示例2: TransformSequences_RemoveCompilerGeneratedBranches

        private static void TransformSequences_RemoveCompilerGeneratedBranches (IEnumerable<Method> methods, SourceRepository sourceRepository, DateTime moduleTime)
        {
            foreach (var method in methods
                     .Where (m => m.FileRefUniqueId != 0
                             && m.SequencePoints.Length != 0)) {
            
                // Get method source if availabile 
                var source = sourceRepository.GetCodeCoverageStringTextSource(method.FileRefUniqueId);
                if (source != null) {

                    if (source.IsChanged (moduleTime)) {
                        ("Source file is modified: " + source.FilePath).InformUser();
                        return;
                    }

                    if (!TransformSequences_RemoveCompilerGeneratedBranches (method, source)) {
                        return; // empty sequence found -> source.IsChanged (failed access to file-times)
                    }
                }
            }
        }
开发者ID:AtwooTM,项目名称:opencover,代码行数:21,代码来源:BasePersistance.cs


注:本文中的SourceRepository.GetCodeCoverageStringTextSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。