< Summary

Information
Class: Renci.SshNet.Sftp.Requests.PosixRenameRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\ExtendedRequests\PosixRenameRequest.cs
Line coverage
100%
Covered lines: 24
Uncovered lines: 0
Coverable lines: 24
Total lines: 62
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_OldPath()100%1100%
set_OldPath(...)100%1100%
get_NewPath()100%1100%
set_NewPath(...)100%1100%
get_Encoding()100%1100%
get_BufferCapacity()100%1100%
.ctor(...)100%1100%
SaveData()100%1100%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\ExtendedRequests\PosixRenameRequest.cs

#LineLine coverage
 1using System;
 2using System.Text;
 3
 4using Renci.SshNet.Sftp.Responses;
 5
 6namespace Renci.SshNet.Sftp.Requests
 7{
 8    internal sealed class PosixRenameRequest : SftpExtendedRequest
 9    {
 10        private byte[] _oldPath;
 11        private byte[] _newPath;
 12
 13        public string OldPath
 14        {
 915            get { return Encoding.GetString(_oldPath, 0, _oldPath.Length); }
 2716            private set { _oldPath = Encoding.GetBytes(value); }
 17        }
 18
 19        public string NewPath
 20        {
 921            get { return Encoding.GetString(_newPath, 0, _newPath.Length); }
 2722            private set { _newPath = Encoding.GetBytes(value); }
 23        }
 24
 2725        public Encoding Encoding { get; }
 26
 27        /// <summary>
 28        /// Gets the size of the message in bytes.
 29        /// </summary>
 30        /// <value>
 31        /// The size of the messages in bytes.
 32        /// </value>
 33        protected override int BufferCapacity
 34        {
 35            get
 336            {
 337                var capacity = base.BufferCapacity;
 338                capacity += 4; // OldPath length
 339                capacity += _oldPath.Length; // OldPath
 340                capacity += 4; // NewPath length
 341                capacity += _newPath.Length; // NewPath
 342                return capacity;
 343            }
 44        }
 45
 46        public PosixRenameRequest(uint protocolVersion, uint requestId, string oldPath, string newPath, Encoding encodin
 947            : base(protocolVersion, requestId, statusAction, "posix-rename@openssh.com")
 948        {
 949            Encoding = encoding;
 950            OldPath = oldPath;
 951            NewPath = newPath;
 952        }
 53
 54        protected override void SaveData()
 355        {
 356            base.SaveData();
 57
 358            WriteBinaryString(_oldPath);
 359            WriteBinaryString(_newPath);
 360        }
 61    }
 62}