public void TimeFormattingTest()
        {
            var oneSecond = microsPerSec;

            Assert.Equal("00:00:01.000", TimeFormatter.FormatTime(oneSecond));

            var oneMinute = 60L * oneSecond;

            Assert.Equal("00:01:00.000", TimeFormatter.FormatTime(oneMinute));

            var oneHour = 60L * oneMinute;

            Assert.Equal("01:00:00.000", TimeFormatter.FormatTime(oneHour));

            var oneHourOneMinuteOneSecond = oneHour + oneMinute + oneSecond;

            Assert.Equal("01:01:01.000", TimeFormatter.FormatTime(oneHourOneMinuteOneSecond));

            Assert.Equal("00:00:00.100", TimeFormatter.FormatTime(100000));
            Assert.Equal("00:00:00.111", TimeFormatter.FormatTime(111000));
            Assert.Equal("00:00:00.000", TimeFormatter.FormatTime(000100));

            var testDate = TimeFormatter.TimeFromDateTime(new DateTime(2010, 10, 20, 8, 13, 37, 125));

            Assert.Equal("2010-10-20\n08:13:37.125", TimeFormatter.FormatTime(testDate));

            Assert.Equal("-01:01:01.000", TimeFormatter.FormatTime(-oneHourOneMinuteOneSecond));
        }
Esempio n. 2
0
 private ToolTip BuildTestToolTip(string text)
 {
     return(new ToolTip
     {
         Content = text + entry.TestType + " test.\nExecution Time:\t" + TimeFormatter.FormatTime(entry.AverageTimeUnder),
         Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom,
     });
 }
Esempio n. 3
0
        private ToolTip BuildRegToolTip()
        {
            var t = new ToolTip
            {
                Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom
            };
            var s = "Called " + entry.TimesCalled + " times in Test Suite";

            if (entry.TimesCalled > 0)
            {
                s += "\nAverage Time:\t" + TimeFormatter.FormatTime(entry.AverageTime) + "\tAverage Time Below:\t" + TimeFormatter.FormatTime(entry.AverageTimeUnder);
            }
            s         = s + "\nRisk Analysis:\t" + (100 - entry.RiskMetric) + "\tNodes Affected:\t\t" + entry.NodeCount;
            s         = s + "\nTests Risk:\t" + entry.TestsScore + "\tGraph Risk:\t\t" + entry.GraphScore;
            t.Content = s;// +"\nComplexity:\t" + entry.Complexity;

            return(t);
        }
Esempio n. 4
0
 private ToolTip BuildSlowTestToolTip()
 {
     return(new ToolTip
     {
         Content = "SIGH! Slow Test, and it was so good.\nExecution Time:\t" + TimeFormatter.FormatTime(entry.AverageTimeUnder),
         Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom
     });
 }
        private Lifeline RecurseElements(Chain item, Lifeline parent, bool inSetup, bool inTest, bool inTeardown)
        {
            var time    = (item.TimeEnd - item.TimeStart);
            var intime  = time - GetChildrenTimes(item);
            var current = GetLifeLine(item.DisplayName);

            if (item.IsTest)
            {
                inTest = true;
            }
            if (item.IsSetup)
            {
                inSetup = true;
            }
            if (item.IsTeardown)
            {
                inTeardown = true;
            }
            if (!(item.DisplayName.Contains("::get_") || item.DisplayName.Contains("::set_")))
            {
                if (parent != null)
                {
                    var message = new Message(seq, parent, current, GetName(item.DisplayName) + " " + TimeFormatter.FormatTime(intime), 2, _dte, GetColor(time), GetOppositeColor(intime));
                    message.Pen      = GetPenColor(inSetup, inTest, inTeardown, time);
                    message.Clicked += message_Clicked;
                    message.GoToSpot = item.Name;
                    _doc.Add(message);
                    seq++;
                }
            }
            foreach (var child in item.Children)
            {
                var childline = RecurseElements(child, current, inSetup, inTest, inTeardown);
                if (current != null && childline != current)
                {
                    if (!(item.DisplayName.Contains("::get_") || item.DisplayName.Contains("::set_")))
                    {
                        var childtime = child.TimeEnd - child.TimeStart;
                        var message   = new Message(seq, childline, current, "", 1, _dte, GetColor(time), GetOppositeColor(time))
                        {
                            Pen      = GetPenColor(inSetup, inTest, inTeardown, childtime),
                            GoToSpot = item.Name
                        };
                        _doc.Add(message);
                        seq++;
                    }
                }
            }
            return(current);
        }