Exemplo n.º 1
0
        public void WriteCountZeroDoesNotThrow()
        {
            // Set up the vault object file operations mock.
            var vaultObjectFileOperationsMock = new Mock <VaultObjectFileOperations>();

            // When UploadFileBlockBegin is called, return a dummy session.
            vaultObjectFileOperationsMock
            .Setup(m => m.UploadFileBlockBegin
                   (
                   ))
            .Returns(() => 1)
            .Verifiable();

            // Set up the mock vault.
            var vaultMock = new Mock <Vault>();

            vaultMock
            .SetupGet(m => m.ObjectFileOperations)
            .Returns(vaultObjectFileOperationsMock.Object);

            // Set up the data to read.
            var data = new byte[1];

            // Read some data.
            var stream = new Extensions.FileUploadStream(Mock.Of <FileVer>(), new ObjID(), vaultMock.Object);

            stream.Write(data, 0, 0);
        }
Exemplo n.º 2
0
        public void WriteThrowsWithNegativeCount()
        {
            var data   = new byte[1];
            var stream = new Extensions.FileUploadStream(Mock.Of <FileVer>(), new ObjID(), Moq.Mock.Of <Vault>());

            stream.Write(data, 0, -1);
        }
Exemplo n.º 3
0
        public void WriteThrowsWithCountLargerThanByteArray2()
        {
            var data   = new byte[1];
            var stream = new Extensions.FileUploadStream(Mock.Of <FileVer>(), new ObjID(), Moq.Mock.Of <Vault>());

            stream.Write(data, 1, 1);
        }
Exemplo n.º 4
0
        public void WriteThrowsWithNullBuffer()
        {
            var stream = new Extensions.FileUploadStream(Mock.Of <FileVer>(), new ObjID(), Moq.Mock.Of <Vault>());

            stream.Write(null, 0, 1);
        }