Ejemplo n.º 1
0
        public void Consturct()
        {
            var array = new byte[1];
            var contentType = "content/type";

            var result = new FileResourceResult(array, contentType);

            Assert.Equal(array, result.Content);
            Assert.Equal(contentType, result.ContentType);
        }
Ejemplo n.º 2
0
        public void Execute()
        {
            var frameworkProviderMock = new Mock<IFrameworkProvider>();
            var contextMock = new Mock<IResourceResultContext>();
            contextMock.Setup(c => c.FrameworkProvider).Returns(frameworkProviderMock.Object);

            var array = new byte[1];
            var contentType = "content/type";

            var result = new FileResourceResult(array, contentType);

            result.Execute(contextMock.Object);

            frameworkProviderMock.Verify(fp => fp.SetHttpResponseHeader("Content-Type", contentType), Times.Once());
            frameworkProviderMock.Verify(fp => fp.WriteHttpResponse(array), Times.Once());
        }