Esempio n. 1
0
        public void HttpResult_WritesStatusCode()
        {
            var controller = new RootController();
            controller.ReplyWith304().Should().BeOfType<HttpResult>();

            var req = WebRequest.CreateDefault(new Uri(BuildUrl("/root/replywith304")));
            var reply = (HttpWebResponse)req.GetResponse();
        }
Esempio n. 2
0
        public void OutputWriterResult_WritesBack()
        {
            var controller = new RootController();
            controller.Index().Should().BeOfType<OutputWriterResult>();

            var req = WebRequest.CreateDefault(new Uri(BuildUrl("/")));
            var reply = (HttpWebResponse) req.GetResponse();

            reply.StatusCode.Should().Be(HttpStatusCode.OK);
            reply.ContentType.Should().Be("text/html");
            new StreamReader(reply.GetResponseStream()).ReadToEnd().Should().Be("Howdy");
        }