我正在使用起订量。这个例子很简单。设置后我无法读取属性。
var mock = new Mock<HttpResponseBase>();
mock.Setup(x => x.Cookies).Returns(new HttpCookieCollection());
mock.Setup(x => x.Headers).Returns(new NameValueCollection());
var response = mock.Object;
// now I set StatusCode
response.StatusCode = 404;
// now I try to read, but StatusCode is 0 here, not 404
var statusCode = response.StatusCode
如您所见,我没有为StatusCode
. 我该怎么做才能让我写和读它?