Example #1
0
        /// <summary>
        /// Adds method statistics to the class.
        /// </summary>
        /// <param name="method">Method statistics.</param>
        internal void AddMethod(MethodStatistics method)
        {
            if (method == null) throw new ArgumentNullException("method");

            method.Class = this;
            _methods.Add(method);
        }
Example #2
0
        /// <summary>
        /// Creates a method coverage statistics based on given coverage buffer.
        /// </summary>
        /// <param name="id">Identification assigned to the method.</param>
        /// <param name="name">Method name.</param>
        /// <param name="fullName">Method full name.</param>
        /// <param name="coverageBuffer">Coverage buffer.</param>
        /// <param name="lines">Lines representing the method.</param>
        /// <param name="files">List to which instrumented files are added.</param>
        /// <param name="lineStartId">Starting identification number for lines.</param>
        /// <returns>New <see cref="MethodStatistics"/> instance.</returns>
        internal static MethodStatistics Create(uint id, string name, string fullName, byte[] coverageBuffer, IList<BlockLineRange> lines, FileSpecList files, ref long lineStartId)
        {
            var coverageStats = CoverageInfo.GetMethodStatistics(coverageBuffer, lines);
            var methodStats = new MethodStatistics(id, name, fullName, coverageStats);

            foreach (var block in BlockCoverage.CreateForMethod(coverageBuffer, lines, files))
                if (methodStats.AddBlock(block))
                    block.Id = lineStartId++;

            return methodStats;
        }