public static ActionResult ToActionResult(this IBusinessErrors status) { if (!status.HasError) { return(new OkResult()); } return(ToActionResult(status.Error !)); }
/// <summary> /// Inherit errors from another business action status and return true if that action failed /// </summary> /// <param name="status">The status that should be inherited</param> /// <returns>Return true if the other status failed</returns> protected bool InheritError(IBusinessErrors status) { if (status.HasError) { SetError(status.Error !); return(true); } return(false); }
public static void AssertError(IBusinessErrors errors, ErrorType?errorType = null, ErrorCode?code = null) { Assert.True(errors.HasError); if (errorType != null) { Assert.Equal(errorType.ToString(), errors.Error.Type); } if (code != null) { Assert.Equal((int)code, errors.Error.Code); } }