摘要:
有两种方式1、模拟Web请求。2、直接本地调用Api接口但是由于本地直接调用没有模拟请求环境,所以request为nullpublic static HttpResponseMessage CreateResponse(this HttpRequestMessage request, HttpStatusCode statusCode, T value);在声明Controller的时候要初始化Request。UserController uc = new UserController() { Request = new HttpRequestMessage() { Properties = 阅读全文