protected void setup()
        {
            Host = new InMemoryHost(startup: new StartupProperties
            {
                OpenRasta =
                {
                    Errors                           =
                    {
                        HandleAllExceptions          = false,
                        HandleCatastrophicExceptions = false
                    }
                }
            });

            Pipeline = null;
            _actions = new Dictionary <Type, Func <ICommunicationContext, Task <PipelineContinuation> > >();
            var manager = Host.HostManager;

            Resolver.AddDependencyInstance(typeof(IErrorCollector), Errors = new TestErrorCollector());
            Resolver.AddDependency <IPathManager, PathManager>();

            _ambientContext = new ContextScope(new AmbientContext());
            _requestScope   = Resolver.CreateRequestScope();
            manager.SetupCommunicationContext(Context = new WriteTrackingResponseCommunicationContext(InnerContext = new InMemoryCommunicationContext()));
        }
Пример #2
0
        async Task HandleHostIncompingRequestReceivedAsync(IncomingRequestEventArgs e)
        {
            using (DependencyManager.ScopedResolver(Resolver))
            {
                var context = new WriteTrackingResponseCommunicationContext(e.Context);
                context.PipelineData[Keys.Request.ResolverRequestScope] = Resolver.CreateRequestScope();

                // register the required dependency in the web context
                SetupCommunicationContext(context);

                await _pipeline.RunAsync(context);
            }
        }