예제 #1
0
        public void Init()
        {
            _request = null;
            _handleRequest = request => new NancyContext
            {
                Request = request,
                Response = new Response
                {
                    StatusCode = HttpStatusCode.OK,
                    Headers = new Dictionary<string, string>(),
                    Contents = stream => { },
                },
            };
            _engine = new StubEngine(r =>
            {
                _request = r;
                return _handleRequest(_request);
            });
            _application = new Application(_engine);

            _env = new Dictionary<string, object>();
            new Environment(_env)
            {
                Version = "1.0",
                Method = "GET",
                UriScheme = "http",
                ServerName = "localhost",
                ServerPort = "80",
                BaseUri = "",
                RequestUri = "/",
                Headers = new Dictionary<string, string>(),
                Body = (next, error, complete) =>
                {
                    complete();
                    return () => { };
                },
            };
        }
예제 #2
0
        public void Init()
        {
            _request       = null;
            _handleRequest = request => new NancyContext
            {
                Request  = request,
                Response = new Response
                {
                    StatusCode = HttpStatusCode.OK,
                    Headers    = new Dictionary <string, string>(),
                    Contents   = stream => { },
                },
            };
            _engine = new StubEngine(r =>
            {
                _request = r;
                return(_handleRequest(_request));
            });
            _application = new Application(_engine);

            _env = new Dictionary <string, object>();
            new Environment(_env)
            {
                Version    = "1.0",
                Method     = "GET",
                UriScheme  = "http",
                ServerName = "localhost",
                ServerPort = "80",
                BaseUri    = "",
                RequestUri = "/",
                Headers    = new Dictionary <string, string>(),
                Body       = (next, error, complete) =>
                {
                    complete();
                    return(() => { });
                },
            };
        }