public void CorrectRequestShouldReturnOKResult()
 {
     var httpReq = new HttpRequest("GET /Home/LivePage HTTP/1.1");
     var controloller = new ApiController(httpReq);
     var result = controloller.ReturnMe("test").GetResponse();
     Assert.AreEqual(result.StatusCode, HttpStatusCode.OK);
 }
 public void EmptyReuqestShouldThrow()
 {
     var httpReq = new HttpRequest(string.Empty);
     var controloller = new ApiController(httpReq);
     var result = controloller.ReturnMe("test").GetResponse();
 }
        public void ReturnMeActionReturnsParameterInTheJsonObject()
        {
            const string Parameter = "someParam123";

            var request = new Mock<IHttpRequest>();
            request.Setup(x => x.ProtocolVersion).Returns(new Version(1, 1));

            var actionResult = new ApiController(request.Object);
            var resultBody = actionResult.ReturnMe(Parameter).GetResponse().Body;

            Assert.AreEqual(string.Format("{{\"param\":\"{0}\"}}", Parameter), resultBody);
        }
        public void ReturnMeActionReturnsJsonContentType()
        {
            const string Parameter = "someParam123";

            var request = new Mock<IHttpRequest>();
            request.Setup(x => x.ProtocolVersion).Returns(new Version(1, 1));

            var actionResult = new ApiController(request.Object);
            var contentType = actionResult.ReturnMe(Parameter).GetResponse().Headers["Content-Type"].First();

            Assert.AreEqual("application/json", contentType);
        }