/// <summary> /// Reports a failed step, and throws an AssertInconclusiveException if needed. /// </summary> /// <param name="assert">The calling assert.</param> /// <param name="step">The <see cref="StepInfo"/> to report to.</param> /// <param name="actualState">The message to include as the actual result in the step, and in the exception.</param> /// <param name="continueOnError">If true, not exception is thrown. if false, <see cref="AssertFailedException"/> is thrown if the condition fails.</param> /// <exception cref="AssertInconclusiveException">Thrown if condition fails and <paramref name="continueOnError"/> is false.</exception> public static void ReportInconclusive(this Assert assert, StepInfo step, string actualState, bool continueOnError = false) { if (actualState != null) { step.Actual.Add(actualState); } if (((int)StepStatusEnum.Fail) > ((int)step.Outcome)) { step.Outcome = StepStatusEnum.Fail; } if (!continueOnError) { //StringBuilder message = new StringBuilder(); //StringBuilder numberedLines; //message.AppendLine(String.Format("STEP {0} [{1}]: Description = {2}", (String.IsNullOrEmpty(step.Name)) ? "" : step.Name, Timestamp.UnixTimestampToDateTime(step.StartTime).ToString(ConsoleReporter.TimeFormat), step.Description)); //numberedLines = NormalizeListToString(step.Expected); //message.AppendLine($"Expected = {numberedLines.ToString()}"); //numberedLines = NormalizeListToString(step.Actual); //message.AppendLine($"Actual = {numberedLines.ToString()}"); //message.AppendLine(String.Format("Outcome = {0}", Enum.GetName(typeof(StepStatusEnum), step.Outcome))); //numberedLines = NormalizeListToString(step.Messages); //message.AppendLine($"Messages: {numberedLines.ToString()}"); throw new AssertInconclusiveException(ConsoleReporter.CreateStepReport(step)); } }