Exemplo n.º 1
0
        public void Delete()
        {
            HttpWebServer aHttpListener = new HttpWebServer("http://127.0.0.1:8094/");

            try
            {
                aHttpListener.StartListening(x =>
                {
                    if (x.Request.HttpMethod == "DELETE")
                    {
                        // OK
                        //x.Response.StatusCode = 200;
                    }
                    else
                    {
                        x.Response.StatusCode = 404;
                    }
                });

                HttpWebResponse aWebResponse = HttpWebClient.Delete(new Uri("http://127.0.0.1:8094/hello/"));
                Assert.AreEqual(HttpStatusCode.OK, aWebResponse.StatusCode);
            }
            finally
            {
                aHttpListener.StopListening();
            }
        }