Exemplo n.º 1
0
        public void WriteFile_DefaultBufferSize_WritesCorrectNumberOfTimes()
        {
            var testResult = new TestStreamedResult(_filePath, _htmlContentType);

            testResult.WriteFile(_response.Object);

            _outputStream.Verify(
                x => x.Write(
                    It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>()
                    ),
                Times.Once()
                );
        }
Exemplo n.º 2
0
        public void WriteFile_ExplicitBufferSize_WritesCorrectNumberOfTimes()
        {
            var testFileLength = (int)new FileInfo(_filePath).Length;
            var testResult     = new TestStreamedResult(_filePath, _htmlContentType, 1);

            testResult.WriteFile(_response.Object);

            _outputStream.Verify(
                x => x.Write(
                    It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>()
                    ),
                Times.Exactly(testFileLength)
                );
        }