예제 #1
0
        protected override void SetupData()
        {
            var random = new Random();

            _path               = random.Next().ToString(CultureInfo.InvariantCulture);
            _handle             = GenerateRandom(random.Next(2, 6), random);
            _bufferSize         = (uint)random.Next(1, 1000);
            _readBufferSize     = (uint)random.Next(1, 1000);
            _writeBufferSize    = (uint)random.Next(100, 1000);
            _readBytes          = new byte[5];
            _actualReadBytes    = GenerateRandom(_readBytes.Length, random);
            _writeBytes         = new byte[] { 0x01, 0x02, 0x03, 0x04 };
            _length             = _readBytes.Length - 2;
            _actualWrittenBytes = null;

            _fileAttributes = new SftpFileAttributesBuilder().WithExtension("X", "ABC")
                              .WithExtension("V", "VValue")
                              .WithGroupId(random.Next())
                              .WithLastAccessTime(DateTime.Now.AddSeconds(random.Next()))
                              .WithLastWriteTime(DateTime.Now.AddSeconds(random.Next()))
                              .WithPermissions((uint)random.Next())
                              .WithSize(_length + 100)
                              .WithUserId(random.Next())
                              .Build();
            _originalFileAttributes = _fileAttributes.Clone();
            _newFileAttributes      = null;
        }
예제 #2
0
        protected override void SetupData()
        {
            var random = new Random();

            _path            = random.Next().ToString(CultureInfo.InvariantCulture);
            _handle          = GenerateRandom(random.Next(2, 6), random);
            _bufferSize      = (uint)random.Next(1, 1000);
            _readBytes1      = new byte[5];
            _readBytes2      = new byte[random.Next(1, 3)];
            _actualReadBytes = GenerateRandom(_readBytes1.Length + _readBytes2.Length + 2, random); // server returns more bytes than the caller requested
            _readBufferSize  = (uint)random.Next(_actualReadBytes.Length, _actualReadBytes.Length * 2);
            _writeBufferSize = (uint)random.Next(100, 1000);
            _length          = _readBytes1.Length + _readBytes2.Length + 5;

            _fileAttributes = new SftpFileAttributesBuilder().WithExtension("X", "ABC")
                              .WithExtension("V", "VValue")
                              .WithGroupId(random.Next())
                              .WithLastAccessTime(DateTime.Now.AddSeconds(random.Next()))
                              .WithLastWriteTime(DateTime.Now.AddSeconds(random.Next()))
                              .WithPermissions((uint)random.Next())
                              .WithSize(_length + 100)
                              .WithUserId(random.Next())
                              .Build();
            _originalFileAttributes = _fileAttributes.Clone();
            _newFileAttributes      = null;
        }