public void Post_To_Set_Location_Header_Build()
{
// This version uses a mock UrlHelper.
var mockRepository = new Mock<SEFDataServiceRequestManager>();
var controller = new BuildController(mockRepository.Object);
BuildStatusResult buildStatus=null ;
controller.Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } };
// Act
HttpResponseMessage actionResult = controller.Post(buildStatus);
Assert.IsNotNull(actionResult);
Assert.AreEqual(HttpStatusCode.Conflict, actionResult.StatusCode);
}
我在webAPI的cs文件中有一些单元测试用例,当我运行tescases时,它显示如下的异常
system.reflection.targetinvocationexception异常已被调用目标抛出 - &gt; System.NullReferenceException:对象引用未设置为对象的实例