//public StepInfo AddStep(string description, string expected, string name) //{ // StepInfo newStep, oldStep = null; // newStep = new StepInfo(description, expected, name) // { // Id = Convert.ToString(this.Steps.Count + 1), // Name = Convert.ToString(this.Steps.Count + 1), // Section = $"{this.Section}/step[{this.Steps.Count + 1}]", // }; // newStep.StatusChanged += Step_StatusChanged; // if (this.Steps.Count > 0) // oldStep = this.Steps[this.Steps.Count - 1]; // this.Steps.Add(newStep); // OnStepAdded(newStep, oldStep); // return newStep; //} public StepInfo AddStep(string description, string expected, string actual, StepStatusEnum status, string name = null) { StepInfo newStep, oldStep = null; string id = ReporterManager.GenerateStepId(); newStep = new StepInfo(description, expected, actual, status, name) { Id = id, // Convert.ToString(this.Steps.Count + 1), Section = $"{this.Section}/step[@id='{id}']", // $"{this.Section}/step[{this.Steps.Count + 1}]", }; if (String.IsNullOrEmpty(name)) { newStep.Name = GetStepName(); } //newStep.Name = Convert.ToString(this.Steps.Count + 1); newStep.StatusChanged += Step_StatusChanged; if (this.Steps.Count > 0) { oldStep = this.Steps[this.Steps.Count - 1]; } this.Steps.Add(newStep); OnStepAdded(newStep, oldStep); return(newStep); }
public StepInfo AddStep(StepInfo step) { StepInfo newStep, oldStep = null; string id = ReporterManager.GenerateStepId(); newStep = new StepInfo(step.Description) { Actual = step.Actual, Expected = step.Expected, Attachments = step.Attachments, ExtraInfo = step.ExtraInfo, Messages = step.Messages, Name = step.Name, StartTime = Timestamp.DateTimeToUnixTimestamp(DateTime.UtcNow), Id = id, // Convert.ToString(this.Steps.Count + 1), Section = $"{this.Section}/step[@id='{id}']", // $"{this.Section}/step[{this.Steps.Count + 1}]", }; if (String.IsNullOrEmpty(step.Name)) { newStep.Name = GetStepName(); } newStep.StatusChanged += Step_StatusChanged; newStep.Outcome = step.Outcome; if (this.Steps.Count > 0) { oldStep = this.Steps[this.Steps.Count - 1]; } this.Steps.Add(newStep); OnStepAdded(newStep, oldStep); return(newStep); }