/// <summary> /// Gets the tasks statistics. /// </summary> /// <param name="tasks">The tasks.</param> public void GetTasksStatistics(List <TaskStatistics> tasks) { if (!_isStarted) { return; } var thisTask = new TaskStatistics { TaskName = Name, FinishedAt = EndTime, ElapsedTime = ElapsedTime.TotalMinutes }; tasks.Add(thisTask); SubTasks.ForEach(item => item.GetTasksStatistics(tasks)); }
/// <summary> /// Serializes this instance. /// </summary> public virtual void Serialize() { if (!_isStarted) { return; } TimeSpan elapsed = EndTime.Subtract(StartTime); Logger.Info("......................................."); Logger.Info(string.Format("{0,-18} : {1}", "Task Name", Name)); if (!ShowOnlyElapsedTime) { Logger.Info(string.Format("{0,-18} : {1}", "Start Time", StartTime.ToLongTimeString())); Logger.Info(string.Format("{0,-18} : {1}", "End Time", EndTime.ToLongTimeString())); } Logger.Info(string.Format("{0,-18} : {1} ms", "Elapsed Time", elapsed.TotalMilliseconds)); Fields.ForEach(item => { if (null != item) { Logger.Info(string.Format("{0,-18} : {1}", item.Name, item.Value)); } } ); SerializeMessages(); if (SyncLogger.EnableReportLog) { // Serialize the logs for Test Reports string reportLog = string.Format("{0,-40} | {1,-12} | {2,-12} | {3,-12}", Name, StartTime.ToLongTimeString(), EndTime.ToLongTimeString(), elapsed.TotalMilliseconds); ReportLog.Dump(reportLog); } SubTasks.ForEach(item => item.Serialize()); }