public void ReadByteTest() { SftpSession session = null; // TODO: Initialize to an appropriate value string path = string.Empty; // TODO: Initialize to an appropriate value FileMode mode = new FileMode(); // TODO: Initialize to an appropriate value SftpFileStream target = new SftpFileStream(session, path, mode); // TODO: Initialize to an appropriate value int expected = 0; // TODO: Initialize to an appropriate value int actual; actual = target.ReadByte(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void ReadShouldStartFromEndOfStream() { SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) .Setup(p => p.RequestRead(_handle, (uint)_length, _readBufferSize)) .Returns(Array <byte> .Empty); var byteRead = _sftpFileStream.ReadByte(); Assert.AreEqual(-1, byteRead); SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint)_length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); }
public void ReadShouldReadStartFromSamePositionAsBeforeSetLength() { SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) .Setup(p => p.RequestRead(_handle, (uint)(_readBytes.Length + _writeBytes.Length), _readBufferSize)) .Returns(new byte[] { 0x0f }); var byteRead = _sftpFileStream.ReadByte(); Assert.AreEqual(0x0f, byteRead); SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint)(_readBytes.Length + _writeBytes.Length), _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); }
public void ReadByteShouldStartReadingAtBeginningOfFile() { var data = GenerateRandom(5, _random); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, 0UL, _readBufferSize)) .Returns(data); var actual = _target.ReadByte(); Assert.AreEqual(data[0], actual); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(1)); SftpSessionMock.Verify(p => p.RequestRead(_handle, 0UL, _readBufferSize), Times.Once); }
public void ReadByteShouldThrowNotSupportedException() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); try { _target.ReadByte(); Assert.Fail(); } catch (NotSupportedException ex) { Assert.IsNull(ex.InnerException); Assert.AreEqual("Read not supported.", ex.Message); } SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(1)); }
protected override void Act() { _actual = _target.ReadByte(); }