Ejemplo n.º 1
0
        public void ContentDispositionHeaderIsEncodedCorrectlyForUnicodeCharacters()
        {
            // Arrange
            Mock <ControllerContext> mockControllerContext = new Mock <ControllerContext>(
                MockBehavior.Strict
                );

            mockControllerContext
            .SetupSet(c => c.HttpContext.Response.ContentType = "application/my-type")
            .Verifiable();
            mockControllerContext
            .Setup(
                c =>
                c.HttpContext.Response.AddHeader(
                    "Content-Disposition",
                    @"attachment; filename*=UTF-8''ABCXYZabcxyz012789!%40%23$%25%5E&%2A%28%29-%3D_+.:~%CE%94"
                    )
                )
            .Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "ABCXYZabcxyz012789!@#$%^&*()-=_+.:~Δ"
            };

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 2
0
        public void ExecuteResultSetsContentDispositionIfSpecified()
        {
            // Arrange
            Mock <ControllerContext> mockControllerContext = new Mock <ControllerContext>(
                MockBehavior.Strict
                );

            mockControllerContext
            .SetupSet(c => c.HttpContext.Response.ContentType = "application/my-type")
            .Verifiable();
            mockControllerContext
            .Setup(
                c =>
                c.HttpContext.Response.AddHeader(
                    "Content-Disposition",
                    "attachment; filename=filename.ext"
                    )
                )
            .Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "filename.ext"
            };

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 3
0
        public void ContentDispositionHeaderIsEncodedCorrectly()
        {
            // See comment in FileResult.cs detailing how the FileDownloadName should be encoded.

            // Arrange
            Mock <ControllerContext> mockControllerContext = new Mock <ControllerContext>(
                MockBehavior.Strict
                );

            mockControllerContext
            .SetupSet(c => c.HttpContext.Response.ContentType = "application/my-type")
            .Verifiable();
            mockControllerContext
            .Setup(
                c =>
                c.HttpContext.Response.AddHeader(
                    "Content-Disposition",
                    @"attachment; filename=""some\\file"""
                    )
                )
            .Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = @"some\file"
            };

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 4
0
        public void ConstructorSetsContentTypeProperty() {
            // Act
            FileResult result = new EmptyFileResult("someContentType");

            // Assert
            Assert.AreEqual("someContentType", result.ContentType);
        }
Ejemplo n.º 5
0
        public async Task ContentDispositionHeader_IsEncodedCorrectly_ForUnicodeCharacters()
        {
            // Arrange
            var httpContext = new Mock <HttpContext>();

            httpContext.SetupSet(c => c.Response.ContentType = "application/my-type").Verifiable();
            httpContext
            .Setup(c => c.Response.Headers.Set(
                       "Content-Disposition",
                       @"attachment; filename*=UTF-8''ABCXYZabcxyz012789!%40%23$%25%5E&%2A%28%29-%3D_+.:~%CE%94"))
            .Verifiable();

            var actionContext = CreateActionContext(httpContext.Object);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "ABCXYZabcxyz012789!@#$%^&*()-=_+.:~Δ"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            httpContext.Verify();
        }
Ejemplo n.º 6
0
        public async Task ContentDispositionHeader_IsEncodedCorrectly()
        {
            // See comment in FileResult.cs detailing how the FileDownloadName should be encoded.

            // Arrange
            var httpContext = new Mock <HttpContext>();

            httpContext.SetupSet(c => c.Response.ContentType = "application/my-type").Verifiable();
            httpContext
            .Setup(c => c.Response.Headers.Set("Content-Disposition", @"attachment; filename=""some\\file"""))
            .Verifiable();

            var actionContext = CreateActionContext(httpContext.Object);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = @"some\file"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            httpContext.Verify();
        }
Ejemplo n.º 7
0
        public void Constructor_SetsContentType()
        {
            // Act
            var result = new EmptyFileResult("text/plain");

            // Assert
            Assert.Equal("text/plain", result.ContentType);
        }
Ejemplo n.º 8
0
        public void FileDownloadNameProperty()
        {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            MemberHelper.TestStringProperty(result, "FileDownloadName", String.Empty, false /* testDefaultValue */, true /* allowNullAndEmpty */);
        }
Ejemplo n.º 9
0
        public void ConstructorSetsContentTypeProperty()
        {
            // Act
            FileResult result = new EmptyFileResult("someContentType");

            // Assert
            Assert.Equal("someContentType", result.ContentType);
        }
Ejemplo n.º 10
0
        public void FileDownloadNameProperty()
        {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            MemberHelper.TestStringProperty(result, "FileDownloadName", String.Empty);
        }
Ejemplo n.º 11
0
        public void Constructor_SetsContentType()
        {
            // Act
            var result = new EmptyFileResult("text/plain");

            // Assert
            Assert.Equal("text/plain", result.ContentType.ToString());
        }
Ejemplo n.º 12
0
        public void ExecuteResultThrowsIfContextIsNull()
        {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            Assert.ThrowsArgumentNull(
                delegate { result.ExecuteResult(null); }, "context");
        }
Ejemplo n.º 13
0
 public Task ExecuteAsync(ActionContext context, EmptyFileResult result)
 {
     SetHeadersAndLog(
         context,
         result,
         fileLength: 0L,
         enableRangeProcessing: true,
         lastModified: result.LastModified);
     result.WasWriteFileCalled = true;
     return(Task.FromResult(0));
 }
Ejemplo n.º 14
0
        public void ExecuteResultThrowsIfContextIsNull()
        {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            ExceptionHelper.ExpectArgumentNullException(
                delegate {
                result.ExecuteResult(null);
            }, "context");
        }
Ejemplo n.º 15
0
        public async Task ExecuteResultAsync_ThrowsException_IfCannotResolveLoggerFactory()
        {
            // Arrange
            var httpContext = new DefaultHttpContext();

            httpContext.RequestServices = new ServiceCollection().BuildServiceProvider();
            var actionContext = CreateActionContext(httpContext);
            var result        = new EmptyFileResult("application/my-type");

            // Act & Assert
            await Assert.ThrowsAsync <InvalidOperationException>(() => result.ExecuteResultAsync(actionContext));
        }
Ejemplo n.º 16
0
        public async Task SetsAcceptRangeHeader()
        {
            // Arrange
            var httpContext   = GetHttpContext();
            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type");

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.Equal("bytes", httpContext.Response.Headers[HeaderNames.AcceptRanges]);
        }
Ejemplo n.º 17
0
        public void ExecuteResultDoesNotSetContentDispositionIfNotSpecified() {
            // Arrange
            Mock<ControllerContext> mockControllerContext = new Mock<ControllerContext>(MockBehavior.Strict);
            mockControllerContext.ExpectSet(c => c.HttpContext.Response.ContentType, "application/my-type").Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type");

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.IsTrue(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 18
0
        public void ExecuteResultDoesNotSetContentDispositionIfNotSpecified()
        {
            // Arrange
            Mock <ControllerContext> mockControllerContext = new Mock <ControllerContext>();

            mockControllerContext.SetupSet(c => c.HttpContext.Response.ContentType = "application/my-type").Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type");

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 19
0
        public void ExecuteResultSetsContentDispositionIfSpecified() {
            // Arrange
            Mock<ControllerContext> mockControllerContext = new Mock<ControllerContext>(MockBehavior.Strict);
            mockControllerContext.ExpectSet(c => c.HttpContext.Response.ContentType, "application/my-type").Verifiable();
            mockControllerContext.Expect(c => c.HttpContext.Response.AddHeader("Content-Disposition", "attachment; filename=filename.ext")).Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type") {
                FileDownloadName = "filename.ext"
            };

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.IsTrue(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 20
0
        public void ContentDispositionHeaderIsEncodedCorrectlyForUnicodeCharacters() {
            // Arrange
            Mock<ControllerContext> mockControllerContext = new Mock<ControllerContext>(MockBehavior.Strict);
            mockControllerContext.ExpectSet(c => c.HttpContext.Response.ContentType, "application/my-type").Verifiable();
            mockControllerContext.Expect(c => c.HttpContext.Response.AddHeader("Content-Disposition", @"attachment; filename*=UTF-8''ABCXYZabcxyz012789!%40%23$%25%5E&%2A%28%29-%3D_+.:~%CE%94")).Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type") {
                FileDownloadName = "ABCXYZabcxyz012789!@#$%^&*()-=_+.:~Δ"
            };

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.IsTrue(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 21
0
        public async Task ExecuteResultAsync_DoesNotSetContentDisposition_IfNotSpecified()
        {
            // Arrange
            var httpContext = new Mock<HttpContext>(MockBehavior.Strict);
            httpContext.SetupSet(c => c.Response.ContentType = "application/my-type").Verifiable();
            httpContext.Setup(c => c.Response.Body).Returns(Stream.Null);

            var actionContext = CreateActionContext(httpContext.Object);

            var result = new EmptyFileResult("application/my-type");

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            httpContext.Verify();
        }
Ejemplo n.º 22
0
        public async Task ExecuteResultAsync_DoesNotSetContentDisposition_IfNotSpecified()
        {
            // Arrange
            var httpContext = new Mock <HttpContext>(MockBehavior.Strict);

            httpContext.SetupSet(c => c.Response.ContentType = "application/my-type").Verifiable();
            httpContext.Setup(c => c.Response.Body).Returns(Stream.Null);

            var actionContext = CreateActionContext(httpContext.Object);

            var result = new EmptyFileResult("application/my-type");

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            httpContext.Verify();
        }
Ejemplo n.º 23
0
        public async Task ExecuteResultAsync_SetsContentDisposition_IfSpecified()
        {
            // Arrange
            var httpContext   = GetHttpContext();
            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "filename.ext"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            Assert.Equal("application/my-type", httpContext.Response.ContentType);
            Assert.Equal("attachment; filename=filename.ext; filename*=UTF-8''filename.ext", httpContext.Response.Headers["Content-Disposition"]);
        }
Ejemplo n.º 24
0
        public async Task ExecuteResultAsync_LogsInformation_IfCanResolveLoggerFactory()
        {
            // Arrange
            var httpContext = new DefaultHttpContext();
            var services    = new ServiceCollection();
            var loggerSink  = new TestSink();

            services.AddSingleton <ILoggerFactory>(new TestLoggerFactory(loggerSink, true));
            httpContext.RequestServices = services.BuildServiceProvider();

            var actionContext = CreateActionContext(httpContext);
            var result        = new EmptyFileResult("application/my-type");

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.Equal(1, loggerSink.Writes.Count);
        }
Ejemplo n.º 25
0
        public void ContentDispositionHeaderIsEncodedCorrectly() {
            // See comment in FileResult.cs detailing how the FileDownloadName should be encoded.

            // Arrange
            Mock<ControllerContext> mockControllerContext = new Mock<ControllerContext>(MockBehavior.Strict);
            mockControllerContext.ExpectSet(c => c.HttpContext.Response.ContentType, "application/my-type").Verifiable();
            mockControllerContext.Expect(c => c.HttpContext.Response.AddHeader("Content-Disposition", @"attachment; filename=""some\\file""")).Verifiable();

            EmptyFileResult result = new EmptyFileResult("application/my-type") {
                FileDownloadName = @"some\file"
            };

            // Act
            result.ExecuteResult(mockControllerContext.Object);

            // Assert
            Assert.IsTrue(result.WasWriteFileCalled);
            mockControllerContext.Verify();
        }
Ejemplo n.º 26
0
        public async Task ContentDispositionHeader_IsEncodedCorrectly_ForUnicodeCharacters()
        {
            // Arrange
            var httpContext   = GetHttpContext();
            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "ABCXYZabcxyz012789!@#$%^&*()-=_+.:~Δ"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            Assert.Equal("application/my-type", httpContext.Response.Headers["Content-Type"]);
            Assert.Equal(@"attachment; filename=""ABCXYZabcxyz012789!@#$%^&*()-=_+.:~_""; filename*=UTF-8''ABCXYZabcxyz012789!%40#$%25^&%2A%28%29-%3D_+.%3A~%CE%94",
                         httpContext.Response.Headers["Content-Disposition"]);
        }
Ejemplo n.º 27
0
        public async Task ContentDispositionHeader_IsEncodedCorrectly_ForUnicodeCharacters()
        {
            // Arrange
            var httpContext = new DefaultHttpContext();
            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "ABCXYZabcxyz012789!@#$%^&*()-=_+.:~Δ"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            Assert.Equal("application/my-type", httpContext.Response.Headers["Content-Type"]);
            Assert.Equal(@"attachment; filename=""ABCXYZabcxyz012789!@#$%^&*()-=_+.:~_""; filename*=UTF-8''ABCXYZabcxyz012789!%40#$%25^&%2A%28%29-%3D_+.%3A~%CE%94",
                httpContext.Response.Headers["Content-Disposition"]);
        }
Ejemplo n.º 28
0
        public async Task IfUnmodifiedSinceComparison_OnlyUsesWholeSeconds(DateTimeOffset ifUnmodifiedSince, int expectedStatusCode)
        {
            // Arrange
            var httpContext = GetHttpContext();

            httpContext.Request.Headers[HeaderNames.IfUnmodifiedSince] = HeaderUtilities.FormatDate(ifUnmodifiedSince);
            var actionContext = CreateActionContext(httpContext);
            // Represents 4/9/2018 11:24:22 AM +00:00
            // Ticks rounded down to seconds: 636588698620000000
            var ticks  = 636588698625969382;
            var result = new EmptyFileResult("application/test")
            {
                LastModified = new DateTimeOffset(ticks, TimeSpan.Zero)
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.Equal(expectedStatusCode, httpContext.Response.StatusCode);
        }
Ejemplo n.º 29
0
        public async Task ContentDispositionHeader_IsEncodedCorrectly()
        {
            // See comment in FileResult.cs detailing how the FileDownloadName should be encoded.

            // Arrange
            var httpContext   = GetHttpContext();
            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = @"some\file"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);

            Assert.Equal("application/my-type", httpContext.Response.Headers["Content-Type"]);
            Assert.Equal(@"attachment; filename=""some\\file""; filename*=UTF-8''some%5Cfile", httpContext.Response.Headers["Content-Disposition"]);
        }
Ejemplo n.º 30
0
        public async Task ContentDispositionHeader_IsEncodedCorrectly()
        {
            // See comment in FileResult.cs detailing how the FileDownloadName should be encoded.

            // Arrange
            var httpContext = new DefaultHttpContext();
            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = @"some\file"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);

            Assert.Equal("application/my-type", httpContext.Response.Headers["Content-Type"]);
            Assert.Equal(@"attachment; filename=""some\\file""; filename*=UTF-8''some%5Cfile", httpContext.Response.Headers["Content-Disposition"]);
        }
Ejemplo n.º 31
0
        public async Task ExecuteResultAsync_SetsContentDisposition_IfSpecified()
        {
            // Arrange
            var httpContext = new Mock <HttpContext>(MockBehavior.Strict);

            httpContext.SetupSet(c => c.Response.ContentType = "application/my-type").Verifiable();
            httpContext
            .Setup(c => c.Response.Headers.Set("Content-Disposition", "attachment; filename=filename.ext"))
            .Verifiable();

            var actionContext = CreateActionContext(httpContext.Object);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "filename.ext"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            httpContext.Verify();
        }
Ejemplo n.º 32
0
        public async Task ExecuteResultAsync_DoesNotSetContentDisposition_IfNotSpecified()
        {
            // Arrange
            var provider = new ServiceCollection()
                           .AddSingleton <ILoggerFactory>(NullLoggerFactory.Instance)
                           .AddSingleton <EmptyFileResultExecutor>()
                           .BuildServiceProvider();

            var httpContext = new DefaultHttpContext();

            httpContext.RequestServices = provider;

            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type");

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            Assert.Equal("application/my-type", httpContext.Response.ContentType);
            Assert.Equal(Stream.Null, httpContext.Response.Body);
        }
Ejemplo n.º 33
0
 public Task ExecuteAsync(ActionContext context, EmptyFileResult result)
 {
     SetHeadersAndLog(context, result);
     result.WasWriteFileCalled = true;
     return Task.FromResult(0);
 }
Ejemplo n.º 34
0
        public void FileDownloadNameProperty() {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            MemberHelper.TestStringProperty(result, "FileDownloadName", String.Empty, false /* testDefaultValue */, true /* allowNullAndEmpty */);
        }
Ejemplo n.º 35
0
        public async Task ExecuteResultAsync_SetsContentDisposition_IfSpecified()
        {
            // Arrange
            var httpContext = new DefaultHttpContext();
            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type")
            {
                FileDownloadName = "filename.ext"
            };

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            Assert.Equal("application/my-type", httpContext.Response.ContentType);
            Assert.Equal("attachment; filename=filename.ext; filename*=UTF-8''filename.ext", httpContext.Response.Headers["Content-Disposition"]);
        }
Ejemplo n.º 36
0
        public void ExecuteResultThrowsIfContextIsNull()
        {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            Assert.ThrowsArgumentNull(
                delegate { result.ExecuteResult(null); }, "context");
        }
Ejemplo n.º 37
0
        public async Task ExecuteResultAsync_ThrowsException_IfCannotResolveLoggerFactory()
        {
            // Arrange
            var httpContext = new DefaultHttpContext();
            httpContext.RequestServices = new ServiceCollection().BuildServiceProvider();
            var actionContext = CreateActionContext(httpContext);
            var result = new EmptyFileResult("application/my-type");

            // Act & Assert
            await Assert.ThrowsAsync<InvalidOperationException>(() => result.ExecuteResultAsync(actionContext));
        }
Ejemplo n.º 38
0
        public async Task ExecuteResultAsync_DoesNotSetContentDisposition_IfNotSpecified()
        {
            // Arrange
            var provider = new ServiceCollection()
                .AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
                .AddSingleton<EmptyFileResultExecutor>()
                .BuildServiceProvider();

            var httpContext = new DefaultHttpContext();
            httpContext.RequestServices = provider;

            var actionContext = CreateActionContext(httpContext);

            var result = new EmptyFileResult("application/my-type");

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.True(result.WasWriteFileCalled);
            Assert.Equal("application/my-type", httpContext.Response.ContentType);
            Assert.Equal(Stream.Null, httpContext.Response.Body);
        }
Ejemplo n.º 39
0
 public Task ExecuteAsync(ActionContext context, EmptyFileResult result)
 {
     SetHeadersAndLog(context, result, 0L, true);
     result.WasWriteFileCalled = true;
     return(Task.FromResult(0));
 }
Ejemplo n.º 40
0
        public async Task ExecuteResultAsync_LogsInformation_IfCanResolveLoggerFactory()
        {
            // Arrange
            var httpContext = new DefaultHttpContext();
            var services = new ServiceCollection();
            var loggerSink = new TestSink();
            services.AddSingleton<ILoggerFactory>(new TestLoggerFactory(loggerSink, true));
            httpContext.RequestServices = services.BuildServiceProvider();

            var actionContext = CreateActionContext(httpContext);
            var result = new EmptyFileResult("application/my-type");

            // Act
            await result.ExecuteResultAsync(actionContext);

            // Assert
            Assert.Equal(1, loggerSink.Writes.Count);
        }
Ejemplo n.º 41
0
        public void FileDownloadNameProperty()
        {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            MemberHelper.TestStringProperty(result, "FileDownloadName", String.Empty);
        }
Ejemplo n.º 42
0
        public void ExecuteResultThrowsIfContextIsNull() {
            // Arrange
            FileResult result = new EmptyFileResult();

            // Act & assert
            ExceptionHelper.ExpectArgumentNullException(
                delegate {
                    result.ExecuteResult(null);
                }, "context");
        }