public void CreatesProperWebPage()
 {
     DirectoryHandler target = new DirectoryHandler();
     Request req = new Request();
     req.HttpPath = "/misc/";
     Assert.AreEqual("<html><head><title>Directory</title></head><body></body></html>", target.Handle(req));
     // TODO: Finish test.
 }
Esempio n. 2
0
        /// <summary>
        /// Sends formed request object to the handlers
        /// </summary>
        /// <param name="request">
        /// </param>
        /// <returns>
        /// Responce
        /// </returns>
        private Response HandleRequest(Request request)
        {
            // create Handlers
            var handler1 = new SessionHandler();
            var handler2 = new DirectoryHandler();
            var handler3 = new AdminHandler();
            var handler4 = new TextHandler();
            var handler5 = new BinaryHandler();
            var handler6 = new ErrorHandler();

            // set Handler sequence of execution
            handler1.SetNext(handler2);
            handler2.SetNext(handler3);
            handler3.SetNext(handler4);
            handler4.SetNext(handler5);
            handler5.SetNext(handler6);

            // handle request
            return handler1.Handle(request);
        }