示例#1
0
        private void WriteStats(StringBuilder sb, OutcomeStats stats, int baseIndent, string id, string label)
        {
            WriteTagOpen("tr", sb, baseIndent + 1, null, false, id);
            WriteTag("td", sb, baseIndent + 2, "stats-label text-muted text-right", label, true, null, "width: 0%; padding-left: 0px !important;");
            WriteTag("td", sb, baseIndent + 2, "passed success text-center", stats.Passed.ToString(), true, null, "width: 3.3333333333333%;");
            WriteTag("td", sb, baseIndent + 2, "skipped warning text-center", stats.Skipped.ToString(), true, null, "width: 3.3333333333333%;");
            WriteTag("td", sb, baseIndent + 2, "failed danger text-center", stats.Failed.ToString(), true, null, "width: 3.3333333333333%;");
            WriteTagOpen("td", sb, baseIndent + 2, "outcome-bar-chart", false, null, "width: 90%;");
            WriteTagOpen("table", sb, baseIndent, "table", false, null, "width: 100%; empty-cells: show; height: 14px;");
            WriteTagOpen("tr", sb, baseIndent + 1, null, false);
            
            if(stats.Total == 0)
            {
                WriteTag("td", sb, baseIndent + 2, "empty-bar", null, true, null, "width: 100%;");
            }
            else
            {
                double passedPercent = stats.Total == 0 ? 0 : (((double)stats.Passed / (double)stats.Total) * 100);
                var passedStyle = String.Format("width: {0}%", passedPercent);
                WriteTag("td", sb, baseIndent + 2, "bar passed-bar bg-success text-center", null, true, null, passedStyle);
                
                double skippedPercent = stats.Total == 0 ? 0 : (((double)stats.Skipped / (double)stats.Total) * 100);
                var skippedStyle = String.Format("width: {0}%", skippedPercent);
                WriteTag("td", sb, baseIndent + 2, "bar skipped-bar bg-warning text-center", null, true, null, skippedStyle);
                
                double failedPercent = stats.Total == 0 ? 0 : (((double)stats.Failed / (double)stats.Total) * 100);
                var failedStyle = String.Format("width: {0}%", failedPercent);
                WriteTag("td", sb, baseIndent + 2, "bar failed-bar bg-danger text-center", null, true, null, failedStyle);
            }

            WriteTagClose("tr", sb, baseIndent + 1);
            WriteTagClose("table", sb, baseIndent);
            WriteTagClose("td", sb, baseIndent + 1);
            WriteTagClose("tr", sb, baseIndent);
        }
示例#2
0
        void DecrementStat(Outcome previousOutcome, OutcomeStats stats)
        {
            switch (previousOutcome)
			{
				case Outcome.Failed:
					stats.Failed--;
					stats.Total--;
					break;
				case Outcome.NotRun:
					break;
				case Outcome.Passed:
					stats.Passed--;
					stats.Total--;
					break;
				case Outcome.Skipped:
					stats.Skipped--;
					stats.Total--;
					break;
			}
        }
示例#3
0
        void IncrementStat(Outcome newOutcome, OutcomeStats stats)
        {
            switch (newOutcome)
			{
				case Outcome.Failed:
					stats.Failed++;
					stats.Total++;
					break;
				case Outcome.NotRun:
					break;
				case Outcome.Passed:
					stats.Passed++;
					stats.Total++;
					break;
				case Outcome.Skipped:
					stats.Skipped++;
					stats.Total++;
					break;
			}
        }
示例#4
0
		void UpdateStats(Outcome previousOutcome, Outcome newOutcome, OutcomeStats stats)
		{
			DecrementStat(previousOutcome, stats);
			IncrementStat(newOutcome, stats);
		}