< Summary

Information
Class: Renci.SshNet.Sftp.Requests.SftpRenameRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\SftpRenameRequest.cs
Line coverage
83%
Covered lines: 25
Uncovered lines: 5
Coverable lines: 30
Total lines: 74
Line coverage: 83.3%
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_SftpMessageType()100%1100%
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%
LoadData()100%10%
SaveData()100%1100%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Text;
 3using Renci.SshNet.Sftp.Responses;
 4
 5namespace Renci.SshNet.Sftp.Requests
 6{
 7    internal sealed class SftpRenameRequest : SftpRequest
 8    {
 9        private byte[] _oldPath;
 10        private byte[] _newPath;
 11
 12        public override SftpMessageTypes SftpMessageType
 13        {
 2714            get { return SftpMessageTypes.Rename; }
 15        }
 16
 17        public string OldPath
 18        {
 919            get { return Encoding.GetString(_oldPath, 0, _oldPath.Length); }
 3620            private set { _oldPath = Encoding.GetBytes(value); }
 21        }
 22
 23        public string NewPath
 24        {
 925            get { return Encoding.GetString(_newPath, 0, _newPath.Length); }
 3626            private set { _newPath = Encoding.GetBytes(value); }
 27        }
 28
 4529        public Encoding Encoding { get; private set; }
 30
 31        /// <summary>
 32        /// Gets the size of the message in bytes.
 33        /// </summary>
 34        /// <value>
 35        /// The size of the messages in bytes.
 36        /// </value>
 37        protected override int BufferCapacity
 38        {
 39            get
 640            {
 641                var capacity = base.BufferCapacity;
 642                capacity += 4; // OldPath length
 643                capacity += _oldPath.Length; // OldPath
 644                capacity += 4; // NewPath length
 645                capacity += _newPath.Length; // NewPath
 646                return capacity;
 647            }
 48        }
 49
 50        public SftpRenameRequest(uint protocolVersion, uint requestId, string oldPath, string newPath, Encoding encoding
 1251            : base(protocolVersion, requestId, statusAction)
 1252        {
 1253            Encoding = encoding;
 1254            OldPath = oldPath;
 1255            NewPath = newPath;
 1256        }
 57
 58        protected override void LoadData()
 059        {
 060            base.LoadData();
 61
 062            _oldPath = ReadBinary();
 063            _newPath = ReadBinary();
 064        }
 65
 66        protected override void SaveData()
 667        {
 668            base.SaveData();
 69
 670            WriteBinaryString(_oldPath);
 671            WriteBinaryString(_newPath);
 672        }
 73    }
 74}