private void VerifyEmbeddedResourceControllerReturn404ForNonexistantResource(EmbeddedResourceController resourceController)
        {
            // act
            var result = resourceController.Index("foobar.gif", null);

            // assert
            result.ShouldBeNull();
            resourceController.Response.StatusCode.ShouldEqual(404);
        }
        private static EmbeddedResourceController InitializeEmbeddedResourceController(string areaName)
        {
            var controller = new EmbeddedResourceController();
            var routeData  = new RouteData();

            routeData.DataTokens.Add("area", areaName);
            controller.ControllerContext = new ControllerContext(MvcMockHelpers.DynamicHttpContextBase(), routeData, controller);
            return(controller);
        }
        private void VerifyEmbeddedResourceControllerReturnEmbeddedImage(EmbeddedResourceController resourceController)
        {
            // act
            var result = resourceController.Index("images.arrow.gif", null) as FileStreamResult;

            // assert
            result.FileStream.ShouldNotBeNull();
            result.ContentType.ShouldEqual("image/gif");
        }
Beispiel #4
0
        public void GetEmbeddedResource_Txt()
        {
            var controller = new EmbeddedResourceController();

            var embeddedResource = controller.GetEmbeddedResource(Constants.TXT_EMBEDDED_RESOURCE_URL);

            Assert.IsNotNull(embeddedResource);
            Assert.IsInstanceOfType(embeddedResource, typeof(FileStreamResult));
            Assert.AreEqual("text/plain", ((FileStreamResult)embeddedResource).ContentType);
        }