示例#1
0
        public void HttpStatusCodeStatus(HttpStatusCode httpStatusCode, ErrorResultType errorResultType)
        {
            var httpMessage  = new HttpRequestMessage(HttpMethod.Get, "localhost");
            var restResponse = GetRestResponse(httpStatusCode, httpStatusCode.ToString(), httpMessage);

            var errorResult = RestStatusError.RestStatusToErrorResult(restResponse);

            Assert.Equal(errorResultType, errorResult.ErrorResultType);
        }
示例#2
0
 public ErrorResult(ErrorResultType errorResultType, string description, Exception?exception)
 {
     ErrorResultType = errorResultType;
     Description     = description;
     Exception       = exception;
 }
示例#3
0
 public string ToString(string?format, IFormatProvider?formatProvider) => ErrorResultType.ToString();
示例#4
0
 public ErrorResult(ErrorResultType errorResultType, string description)
     : this(errorResultType, description, null)
 {
 }
示例#5
0
 public BadRequestException(string field, string fieldMessage, ErrorResultType type) : base(field, fieldMessage, type)
 {
 }
示例#6
0
 public BaseException(string field, string fieldMessage, ErrorResultType type)
 {
     this.Errors.Add(new ValidationError(field, fieldMessage, type));
 }
示例#7
0
 public NotFoundException(string field, string fieldMessage, ErrorResultType type) : base(field, fieldMessage, type)
 {
 }
示例#8
0
 public ValidationError(string field, string message, ErrorResultType type)
 {
     this.Field   = field;
     this.Message = message;
     this.Type    = type;
 }