本文整理汇总了C#中IResponse.Stub方法的典型用法代码示例。如果您正苦于以下问题:C# IResponse.Stub方法的具体用法?C# IResponse.Stub怎么用?C# IResponse.Stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResponse
的用法示例。
在下文中一共展示了IResponse.Stub方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
_handler = new NonCacheableResponseHandler();
_httpRequest = MockRepository.GenerateMock<HttpRequestBase>();
_httpCachePolicyBase = MockRepository.GenerateMock<HttpCachePolicyBase>();
_httpResponse = MockRepository.GenerateMock<HttpResponseBase>();
_httpResponse.Stub(arg => arg.BinaryWrite(Arg<byte[]>.Is.Anything)).WhenCalled(arg => _responseWritten = true);
_httpResponse.Stub(arg => arg.Cache).Return(_httpCachePolicyBase);
_cachePolicy = MockRepository.GenerateMock<ICachePolicy>();
_cachePolicy.Stub(arg => arg.Clone()).Return(_cachePolicy);
_response = MockRepository.GenerateMock<IResponse>();
_response.Stub(arg => arg.CachePolicy).Return(_cachePolicy);
_response.Stub(arg => arg.Cookies).Return(Enumerable.Empty<Cookie>());
_response.Stub(arg => arg.GetContent()).Return(new byte[0]);
_response.Stub(arg => arg.Headers).Return(Enumerable.Empty<Header>());
_response.Stub(arg => arg.StatusCode).Return(new StatusAndSubStatusCode(HttpStatusCode.OK));
_cache = MockRepository.GenerateMock<ICache>();
_result = _handler.HandleResponse(_httpRequest, _httpResponse, _response, _cache, "key");
}
示例2: SetUp
public void SetUp()
{
_systemClock = MockRepository.GenerateMock<ISystemClock>();
_handler = new CacheableResponseHandler(_systemClock);
_httpRequest = MockRepository.GenerateMock<HttpRequestBase>();
_httpRequest.Stub(arg => arg.Headers).Return(new NameValueCollection());
_httpResponse = MockRepository.GenerateMock<HttpResponseBase>();
_httpResponse.Stub(arg => arg.Headers).Return(new NameValueCollection());
_cachePolicy = MockRepository.GenerateMock<ICachePolicy>();
_cachePolicy.Stub(arg => arg.Clone()).Return(_cachePolicy);
_cachePolicy.Stub(arg => arg.ClientCacheExpirationUtcTimestamp).Return(DateTime.UtcNow);
_response = MockRepository.GenerateMock<IResponse>();
_response.Stub(arg => arg.CachePolicy).Return(_cachePolicy);
_response.Stub(arg => arg.Cookies).Return(Enumerable.Empty<Cookie>());
_response.Stub(arg => arg.Headers).Return(Enumerable.Empty<Header>());
_response.Stub(arg => arg.StatusCode).Return(new StatusAndSubStatusCode(HttpStatusCode.OK));
_response.Stub(arg => arg.GetContent()).Return(new byte[0]);
_cache = MockRepository.GenerateMock<ICache>();
}
示例3: SetUp
public void SetUp()
{
_handler = new DescriptiveTextStatusCodeHandler(200);
_httpRequest = MockRepository.GenerateMock<HttpRequestBase>();
_httpRequest.Stub(arg => arg.Headers).Return(new NameValueCollection());
_httpCachePolicyBase = MockRepository.GenerateMock<HttpCachePolicyBase>();
_httpResponse = MockRepository.GenerateMock<HttpResponseBase>();
_httpResponse.Stub(arg => arg.Cache).Return(_httpCachePolicyBase);
_httpResponse.Stub(arg => arg.TrySkipIisCustomErrors).PropertyBehavior();
_cachePolicy = MockRepository.GenerateMock<ICachePolicy>();
_cachePolicy.Stub(arg => arg.Clone()).Return(_cachePolicy);
_response = MockRepository.GenerateMock<IResponse>();
_response.Stub(arg => arg.CachePolicy).Return(_cachePolicy);
_response.Stub(arg => arg.Cookies).Return(Enumerable.Empty<Cookie>());
_response.Stub(arg => arg.GetContent()).Return(new byte[0]);
_response.Stub(arg => arg.Headers).Return(Enumerable.Empty<Header>());
}