private UnitTestResult BuildUnitTestResult(CompareResult result)
        {
            var utr = new UnitTestResult()
            {
                TestName = FormatUnitTestName(result),
                Outcome  = GetOutcome(result),
                Duration = PrinterHelpers.FormatNsToTimespan((long)result.DiffResult.Statistics.Median)
            };

            if (result.Conclusion == EquivalenceTestConclusion.Slower)
            {
                utr.Output = new Output()
                {
                    ErrorInfo = new ErrorInfo()
                    {
                        Message = $"{result.Id} has regressed, was {result.BaseResult.Statistics.Median} is {result.DiffResult.Statistics.Median}.",
                    }
                };
            }
            else if (result.Conclusion == EquivalenceTestConclusion.Unknown)
            {
                utr.Output = new Output()
                {
                    ErrorInfo = new ErrorInfo()
                    {
                        Message = $"{result.Id} has encountered an error.",
                    }
                };
            }

            return(utr);
        }
Esempio n. 2
0
        public void FormatNsToTimeSpanAgain()
        {
            var test = TimeSpan.FromSeconds(43);

            Assert.Equal("00:00:43", PrinterHelpers.FormatNsToTimespan(test.Ticks * 100));

            test = TimeSpan.FromMinutes(75);
            Assert.Equal("01:15:00", PrinterHelpers.FormatNsToTimespan(test.Ticks * 100));

            test = TimeSpan.FromSeconds(365);
            Assert.Equal("00:06:05", PrinterHelpers.FormatNsToTimespan(test.Ticks * 100));
        }
Esempio n. 3
0
 public void FormatNsToTimeSpan(string expected, long value)
 {
     Assert.Equal(expected, PrinterHelpers.FormatNsToTimespan(value));
 }