Пример #1
0
        public void Should_Return_Error_For_Unsatisfiable_Byte_Range()
        {
            var env = new MockRequest().EnvironmentFor("/cgi/test");
            env["HTTP_RANGE"] = "bytes=1234-5678";
            var response = new MockResponse(new File(_docRoot).Call(env));

            Assert.AreEqual(416, response.Status);
            Assert.AreEqual("bytes */193", response["Content-Range"]);
        }
Пример #2
0
        public void Should_Return_Correct_Byte_Range_In_Body()
        {
            var env = new MockRequest().EnvironmentFor("/cgi/test");
            env["HTTP_RANGE"] = "bytes=22-33";
            var response = new MockResponse(new File(_docRoot).Call(env));

            Assert.AreEqual(206, response.Status);
            Assert.AreEqual("12", response["Content-Length"]);
            Assert.AreEqual("bytes 22-33/193", response["Content-Range"]);
            Assert.AreEqual("-*- test -*-", response.Body.ToString());
        }
Пример #3
0
 private void AssertBasicAuthChallenge(MockResponse response)
 {
     Assert.AreEqual(401, response.Status);
     Assert.IsTrue(response.Headers.ContainsKey("WWW-Authenticate"));
     Assert.IsTrue(response["WWW-Authenticate"].Contains("Basic realm=\"" + Realm + "\""));
     Assert.IsEmpty(response.Body.ToString());
 }