Assert.Throws<HttpResponseException>(() => ApiController.Post("query-params-string", "request-body-json"));
现在我想查看HttpResponseException.Response.StatusCode
有什么办法吗?
答案 0 :(得分:2)
HttpResponseException ex = Assert.Throws<HttpResponseException>(() => ApiController.Post("query-params-string", "request-body-json"));<br>
Assert.AreEqual(ex.Response.StatusCode, HttpStatusCode.NotFound);