【发布时间】:2017-03-16 10:04:14
【问题描述】:
我正在使用 JustMock 的免费版本来编写单元测试。我有一个继承 system.web.Http.ApiController 类的 CustomApiController 类。因此,system.web.Http.ApiController 类中有一个名为 Request 的属性(它属于 System.Net.Http.HttpRequestMessage 类型。现在,在我编写单元测试的方法中,有如下内容:
if (this.Request.Headers.TryGetValues("HeaderName", out someCollectionOfStrings)
如何安排/模拟 Request 对象以将其返回为 true?
【问题讨论】:
标签: c# unit-testing mocking justmock