< Summary

Information
Class: Renci.SshNet.Sftp.Requests.SftpFStatRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\SftpFStatRequest.cs
Line coverage
86%
Covered lines: 26
Uncovered lines: 4
Coverable lines: 30
Total lines: 66
Line coverage: 86.6%
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_SftpMessageType()100%1100%
get_Handle()100%1100%
get_BufferCapacity()100%1100%
.ctor(...)100%1100%
LoadData()100%10%
SaveData()100%1100%
Complete(...)100%2100%

File(s)

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

#LineLine coverage
 1using System;
 2
 3using Renci.SshNet.Sftp.Responses;
 4
 5namespace Renci.SshNet.Sftp.Requests
 6{
 7    internal sealed class SftpFStatRequest : SftpRequest
 8    {
 9        private readonly Action<SftpAttrsResponse> _attrsAction;
 10
 11        public override SftpMessageTypes SftpMessageType
 12        {
 35713            get { return SftpMessageTypes.FStat; }
 14        }
 15
 36016        public byte[] Handle { get; private set; }
 17
 18        /// <summary>
 19        /// Gets the size of the message in bytes.
 20        /// </summary>
 21        /// <value>
 22        /// The size of the messages in bytes.
 23        /// </value>
 24        protected override int BufferCapacity
 25        {
 26            get
 11627            {
 11628                var capacity = base.BufferCapacity;
 11629                capacity += 4; // Handle length
 11630                capacity += Handle.Length; // Handle
 11631                return capacity;
 11632            }
 33        }
 34
 35        public SftpFStatRequest(uint protocolVersion, uint requestId, byte[] handle, Action<SftpAttrsResponse> attrsActi
 12536            : base(protocolVersion, requestId, statusAction)
 12537        {
 12538            Handle = handle;
 12539            _attrsAction = attrsAction;
 12540        }
 41
 42        protected override void LoadData()
 043        {
 044            base.LoadData();
 045            Handle = ReadBinary();
 046        }
 47
 48        protected override void SaveData()
 11649        {
 11650            base.SaveData();
 11651            WriteBinaryString(Handle);
 11652        }
 53
 54        public override void Complete(SftpResponse response)
 11955        {
 11956            if (response is SftpAttrsResponse attrsResponse)
 11657            {
 11658                _attrsAction(attrsResponse);
 11659            }
 60            else
 361            {
 362                base.Complete(response);
 363            }
 11964        }
 65    }
 66}