Esempio n. 1
0
        public GetEventTest()
        {
            _fixture = new Fixture();

            _logger         = Substitute.For <ILogger <GetEvent> >();
            _thingActivator = Substitute.For <IThingActivator>();
            _service        = Substitute.For <IServiceProvider>();
            _routeValue     = Substitute.For <IHttpRouteValue>();

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

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

            _service.GetService(typeof(IHttpRouteValue))
            .Returns(_routeValue);

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

            _httpContext.RequestServices
            .Returns(_service);

            _httpContext.Response
            .Returns(_response);
        }
Esempio n. 2
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);
        }