< Summary

Information
Class: Renci.SshNet.Sftp.Requests.SftpRealPathRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\SftpRealPathRequest.cs
Line coverage
93%
Covered lines: 30
Uncovered lines: 2
Coverable lines: 32
Total lines: 74
Line coverage: 93.7%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_SftpMessageType()100%1100%
get_Path()100%1100%
set_Path(...)100%1100%
get_Encoding()100%1100%
get_BufferCapacity()100%1100%
.ctor(...)50%277.77%
SaveData()100%1100%
Complete(...)100%2100%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\SftpRealPathRequest.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 SftpRealPathRequest : SftpRequest
 9    {
 10        private readonly Action<SftpNameResponse> _nameAction;
 11        private byte[] _path;
 12
 13        public override SftpMessageTypes SftpMessageType
 14        {
 3494715            get { return SftpMessageTypes.RealPath; }
 16        }
 17
 18        public string Path
 19        {
 920            get { return Encoding.GetString(_path, 0, _path.Length); }
 3496521            private set { _path = Encoding.GetBytes(value); }
 22        }
 23
 1166124        public Encoding Encoding { get; }
 25
 26        /// <summary>
 27        /// Gets the size of the message in bytes.
 28        /// </summary>
 29        /// <value>
 30        /// The size of the messages in bytes.
 31        /// </value>
 32        protected override int BufferCapacity
 33        {
 34            get
 1164635            {
 1164636                var capacity = base.BufferCapacity;
 1164637                capacity += 4; // Path length
 1164638                capacity += _path.Length; // Path
 1164639                return capacity;
 1164640            }
 41        }
 42
 43        public SftpRealPathRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action<SftpName
 1165544            : base(protocolVersion, requestId, statusAction)
 1165545        {
 1165546            if (nameAction is null)
 047            {
 048                throw new ArgumentNullException(nameof(nameAction));
 49            }
 50
 1165551            Encoding = encoding;
 1165552            Path = path;
 1165553            _nameAction = nameAction;
 1165554        }
 55
 56        protected override void SaveData()
 1164657        {
 1164658            base.SaveData();
 1164659            WriteBinaryString(_path);
 1164660        }
 61
 62        public override void Complete(SftpResponse response)
 1162263        {
 1162264            if (response is SftpNameResponse nameResponse)
 1152265            {
 1152266                _nameAction(nameResponse);
 1152267            }
 68            else
 10069            {
 10070                base.Complete(response);
 10071            }
 1162272        }
 73    }
 74}