< Summary

Information
Class: Renci.SshNet.Sftp.Requests.StatVfsRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\ExtendedRequests\StatVfsRequest.cs
Line coverage
100%
Covered lines: 28
Uncovered lines: 0
Coverable lines: 28
Total lines: 65
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\ExtendedRequests\StatVfsRequest.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 StatVfsRequest : SftpExtendedRequest
 9    {
 10        private readonly Action<SftpExtendedReplyResponse> _extendedReplyAction;
 11        private byte[] _path;
 12
 13        public string Path
 14        {
 915            get { return Encoding.GetString(_path, 0, _path.Length); }
 7216            private set { _path = Encoding.GetBytes(value); }
 17        }
 18
 5419        public Encoding Encoding { get; private set; }
 20
 21        /// <summary>
 22        /// Gets the size of the message in bytes.
 23        /// </summary>
 24        /// <value>
 25        /// The size of the messages in bytes.
 26        /// </value>
 27        protected override int BufferCapacity
 28        {
 29            get
 1530            {
 1531                var capacity = base.BufferCapacity;
 1532                capacity += 4; // Path length
 1533                capacity += _path.Length; // Path
 1534                return capacity;
 1535            }
 36        }
 37
 38        public StatVfsRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action<SftpExtendedR
 2439            : base(protocolVersion, requestId, statusAction, "statvfs@openssh.com")
 2440        {
 2441            Encoding = encoding;
 2442            Path = path;
 43
 2444            _extendedReplyAction = extendedAction;
 2445        }
 46
 47        protected override void SaveData()
 1548        {
 1549            base.SaveData();
 1550            WriteBinaryString(_path);
 1551        }
 52
 53        public override void Complete(SftpResponse response)
 1254        {
 1255            if (response is SftpExtendedReplyResponse extendedReplyResponse)
 956            {
 957                _extendedReplyAction(extendedReplyResponse);
 958            }
 59            else
 360            {
 361                base.Complete(response);
 362            }
 1263        }
 64    }
 65}