コード例 #1
0
 public void ShouldResolvePathForMountedDirectory()
 {
     var req = new Request();
     req.MountPoint = new MountPoint { VirtualPath = "/vdir" };
     req.VirtualPath = "/vdir";
     var handler = new StaticFileHandler(@"c:\webroot");
     Assert.AreEqual(@"c:\webroot", handler.FindRequestedPhysicalPath(req));
     //should be tolerant to trailing backslashes
     handler = new StaticFileHandler(@"c:\webroot\");
     Assert.AreEqual(@"c:\webroot", handler.FindRequestedPhysicalPath(req));
 }
コード例 #2
0
ファイル: RequestFactory.cs プロジェクト: sergiopereira/juicy
        public IRequest Create(IEnumerable<string> requestLines, MountPoint mount, string vpath)
        {
            if (vpath == null) throw new ArgumentNullException("vpath");

            var request = new Request { MountPoint = mount, VirtualPath = vpath };

            PopulateRequestPostedData(request, requestLines);
            PopulateRequestHeaders(request, requestLines);
            PopulateRequestQueryStringValues(request, vpath);

            return request;
        }
コード例 #3
0
        public void ShouldCallLambdaWithReqResp()
        {
            IRequest req = new Request();
            IResponse resp = new Response();
            bool called = false;

            var h = new InlineHandler((request, response) =>
                {
                    Assert.AreSame(req, request);
                    Assert.AreSame(resp, response);
                    called = true;
                });

            h.Respond(req, resp);
            Assert.IsTrue(called);
        }