public static void ShouldHaveRuntimeStatus(this ICommandResult commandResult, CommandRuntimeStatus runtimeStatus) { if (commandResult is null) { throw new ArgumentNullException(nameof(commandResult)); } var message = new StringBuilder(); message.AppendLine($"Runtime Status is not '{runtimeStatus}' but '{commandResult.RuntimeStatus}'"); foreach (var error in commandResult.Errors) { if (error == commandResult.Errors.First()) { message.AppendLine("Errors:"); } message.Append($"- [{error.Severity}] {error.Message}"); } Assert.True(commandResult.RuntimeStatus == runtimeStatus, message.ToString()); }
public static bool IsUnknown(this CommandRuntimeStatus status) => status == CommandRuntimeStatus.Unknown;
public static bool IsActive(this CommandRuntimeStatus status) => status == CommandRuntimeStatus.ContinuedAsNew || status == CommandRuntimeStatus.Pending || status == CommandRuntimeStatus.Running;
public static bool IsFinal(this CommandRuntimeStatus status) => status == CommandRuntimeStatus.Canceled || status == CommandRuntimeStatus.Completed || status == CommandRuntimeStatus.Failed || status == CommandRuntimeStatus.Terminated;