コード例 #1
0
        /// <summary>
        /// Summarises the test results by grouping by assembly and then by class.
        /// </summary>
        void SummariseByClass()
        {
            SummaryByClass = new TestResultSummary();

            var sbaRows = ResultLines.GroupBy(r => new { r.AssemblyPathName, r.ClassName })
                          .Select(gr => new
                          {
                              AssemblyPathName = gr.Key.AssemblyPathName,
                              FullClassName = gr.Key.ClassName,
                              TestResults = gr
                          });

            foreach (var sbaRow in sbaRows)
            {
                var summary = new TestResultSummaryLine();
                summary.AssemblyPathName = sbaRow.AssemblyPathName;
                summary.FullClassName = sbaRow.FullClassName;

                foreach (var ocn in OutcomeNames)
                {
                    var oc = new ResultOutcomeSummary() { Outcome = ocn };
                    oc.NumTests = (from r in sbaRow.TestResults where r.Outcome == ocn select r).Count();
                    oc.TotalDurationInSeconds = (from r in sbaRow.TestResults where r.Outcome == ocn select r).Sum(r => r.DurationInSeconds);
                    summary.Outcomes.Add(oc);
                }

                SummaryByClass.Add(summary);
            }
        }
コード例 #2
0
ファイル: ResultFileModel.cs プロジェクト: hravnx/VSRipGrep
        internal void AddRipGrepOutput(string output)
        {
            var splittedOutput = output.Split(":".ToCharArray(), 3);

            if (splittedOutput.Length != 2 && splittedOutput.Length != 3)
            {
                return;
            }

            ResultLineModel resultLine;

            var line   = Convert.ToUInt32(splittedOutput[0]);
            var column = Convert.ToUInt32(splittedOutput[1]);

            if (!Lines.TryGetValue(line, out resultLine))
            {
                resultLine = new ResultLineModel(this, line, column, splittedOutput[2].Trim());
                Lines.Add(line, resultLine);
                ResultLines.Add(resultLine);

                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NumberOfChildItems"));
            }
        }
コード例 #3
0
 public IEnumerable <string> GetLines()
 {
     return(ResultLines.Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => s.Trim()));
 }
コード例 #4
0
 public string GetLine()
 {
     return(ResultLines.Single(s => !string.IsNullOrWhiteSpace(s)).Trim());
 }
コード例 #5
0
        public void Add(TestResult result)
        {
            result.ThrowIfNull("result");

            ResultLines.Add(result);
        }