public void SetDataFrom(BinaryReader reader)
 {
     CorrelationId = new Guid(reader.ReadString());
     Item = reader.ReadString();
     Test = new Chain();
     Test.ReadDataFrom(reader);
 }
 public void ReadDataFrom(BinaryReader reader)
 {
     Name = reader.ReadString();
     DisplayName = reader.ReadString();
     IsSetup = reader.ReadBoolean();
     IsTest = reader.ReadBoolean();
     IsTeardown = reader.ReadBoolean();
     TimeStart = reader.ReadDouble();
     TimeEnd = reader.ReadDouble();
     var childrenCount = reader.ReadInt32();
     for(int i=0;i<childrenCount;i++)
     {
         var child = new Chain();
         child.ReadDataFrom(reader);
         Children.Add(child);
     }
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 private double GetChildrenTimes(Chain item)
 {
     double ret = 0;
     if (item.Children == null || item.Children.Count == 0) return 0;
     foreach (var child in item.Children)
     {
         ret += child.TimeEnd - child.TimeStart;
     }
     return ret;
 }
 private static string RecurseElements(int depth, Chain test)
 {
     var children = test.Children.Aggregate("", (current, child) => current + RecurseElements(depth + 1, child));
     return new string(' ',depth + 1) + test.DisplayName + (depth != 0 ? (test.TimeEnd - test.TimeStart).ToString("#.000") + " ms here " : "") + "\r\n" + children;
 }
        private Lifeline RecurseElements(Chain item, Lifeline parent, bool inSetup, bool inTest, bool inTeardown)
        {
            var current = GetLifeLine(item.DisplayName);
            if (item.IsTest) inTest = true;
            if (item.IsSetup) inSetup = true;
            if (item.IsTeardown) inTeardown = true;
            if (parent != null)
            {
                var message = new Message(seq, parent, current, GetName(item.DisplayName), 1, _dte);
                message.Pen = GetPenColor(inSetup, inTest, inTeardown);
                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)
                {
                    var message = new Message(seq, childline, current, "", 1, _dte);
                    message.Pen = GetPenColor(inSetup, inTest, inTeardown);
                    message.GoToSpot = item.Name;
                    doc.Add(message);
                    seq++;
                }
            }
            return current;
        }
 private static int CountChildren(Chain test)
 {
     int count = 1;
     if (test.Children == null) return 1;
     foreach(var t in test.Children)
     {
         count += CountChildren(t);
     }
     return count;
 }
 private static Chain BuildChain(CallChain callChain, bool isSetup, bool isTest, bool isTeardown )
 {
     var chain = new Chain(callChain.Runtime, callChain.Name);
     chain.IsSetup = isSetup;
     chain.IsTest = isTest;
     chain.IsTeardown = isTeardown;
     chain.TimeStart = callChain.StartTime;
     chain.TimeEnd = callChain.EndTime;
     foreach(var child in callChain.Children)
     {
         chain.Children.Add(BuildChain(child, false, false, false));
     }
     return chain;
 }