コード例 #1
0
        public static ActionResult ToActionResult(this IBusinessErrors status)
        {
            if (!status.HasError)
            {
                return(new OkResult());
            }

            return(ToActionResult(status.Error !));
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        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);
            }
        }