Пример #1
0
        public void Constructor_WithPathToExistingJsFile_ShouldReturnAResponseWithContentsOfJsFile()
        {
            var response = new StaticFileResponse("../../Fakes/Files/SimpleJs.js", "text/javascript");

            var stream = new MemoryStream();
            response.Contents.Invoke(stream);
            stream.Position = 0;
            var reader = new StreamReader(stream);
            var contents = reader.ReadToEnd();

            Assert.That(contents, Contains.Substring("var myAlert = function (a) { alert(a); }"));
        }
Пример #2
0
        public void Constructor_WithPathToNonExistingJsFile_ShouldReturnAResponseWithStatusCodeNotFound()
        {
            var response = new StaticFileResponse("../../Fakes/Files/NotFoundJs.js", "text/javascript");

            Assert.That(response.StatusCode, Is.EqualTo(404));
        }
Пример #3
0
        public void Constructor_WithPathToExistingJsFile_ShouldReturnAResponseWithStatusCodeOk()
        {
            var response = new StaticFileResponse("../../Fakes/Files/SimpleJs.js", "text/javascript");

            Assert.That(response.StatusCode, Is.EqualTo(200));
        }
Пример #4
0
        public void Constructor_WithPathToExistingJsFile_ShouldReturnAResponseWithCorrectContentType()
        {
            var response = new StaticFileResponse("../../Fakes/Files/SimpleJs.js", "text/javascript");

            Assert.That(response.ContentType, Is.EqualTo("text/javascript"));
        }