예제 #1
0
        public GetThingsTest()
        {
            _fixture = new Fixture();

            _logger         = Substitute.For <ILogger <GetThings> >();
            _writer         = Substitute.For <IHttpBodyWriter>();
            _service        = Substitute.For <IServiceProvider>();
            _thingActivator = Substitute.For <IThingActivator>();
            _wsUrlBuilder   = Substitute.For <IWsUrlBuilder>();
            _descriptor     = Substitute.For <IDescriptor <Thing> >();

            _service.GetService(typeof(IThingActivator))
            .Returns(_thingActivator);

            _service.GetService(typeof(ILogger <GetThings>))
            .Returns(_logger);

            _service.GetService(typeof(IWsUrlBuilder))
            .Returns(_wsUrlBuilder);

            _service.GetService(typeof(IDescriptor <Thing>))
            .Returns(_descriptor);

            _service.GetService(typeof(IHttpBodyWriter))
            .Returns(_writer);

            _response    = Substitute.For <HttpResponse>();
            _httpContext = Substitute.For <HttpContext>();

            _httpContext.RequestServices
            .Returns(_service);

            _httpContext.Response
            .Returns(_response);
        }
예제 #2
0
 public WsUrlBuilderTest()
 {
     _fixture = new Fixture();
     _builder = new WsUrlBuilder();
     _request = Substitute.For <HttpRequest>();
 }