コード例 #1
0
        public void Constructor_FromHttpStatusCode()
        {
            var exception = new ProblemDetailsException(400);

            Assert.IsType <StatusCodeProblemDetails>(exception.Details);
            Assert.Equal(400, exception.Details.Status);
            Assert.Equal(ReasonPhrases.GetReasonPhrase(400), exception.Details.Title);
        }
コード例 #2
0
        public void Constructor_FromHttpStatusCodeAndInnerException()
        {
            var exception = new ProblemDetailsException(400, new DivideByZeroException());

            Assert.IsType <Microsoft.AspNetCore.Mvc.ProblemDetails>(exception.Details);
            Assert.IsType <DivideByZeroException>(exception.InnerException);
            Assert.Equal(400, exception.Details.Status);
            Assert.Equal(ReasonPhrases.GetReasonPhrase(400), exception.Details.Title);
        }