当前位置: 首页>>代码示例>>C#>>正文


C# IResponse.Stub方法代码示例

本文整理汇总了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");
 }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:19,代码来源:NonCacheableResponseHandlerTester.cs

示例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>();
 }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:19,代码来源:CacheableResponseHandlerTester.cs

示例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>());
 }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:17,代码来源:DescriptiveTextStatusCodeHandlerTester.cs


注:本文中的IResponse.Stub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。