< Summary

Information
Class: Renci.SshNet.Sftp.Requests.SftpRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\SftpRequest.cs
Line coverage
85%
Covered lines: 23
Uncovered lines: 4
Coverable lines: 27
Total lines: 61
Line coverage: 85.1%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_RequestId()100%1100%
get_ProtocolVersion()100%1100%
get_BufferCapacity()100%1100%
.ctor(...)100%1100%
Complete(...)50%275%
LoadData()100%10%
SaveData()100%1100%

File(s)

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

#LineLine coverage
 1using System;
 2using Renci.SshNet.Sftp.Responses;
 3
 4namespace Renci.SshNet.Sftp.Requests
 5{
 6    internal abstract class SftpRequest : SftpMessage
 7    {
 8        private readonly Action<SftpStatusResponse> _statusAction;
 9
 6325210        public uint RequestId { get; }
 11
 7512        public uint ProtocolVersion { get; }
 13
 14        /// <summary>
 15        /// Gets the size of the message in bytes.
 16        /// </summary>
 17        /// <value>
 18        /// The size of the messages in bytes.
 19        /// </value>
 20        protected override int BufferCapacity
 21        {
 22            get
 3165623            {
 3165624                var capacity = base.BufferCapacity;
 3165625                capacity += 4; // RequestId
 3165626                return capacity;
 3165627            }
 28        }
 29
 3184230        protected SftpRequest(uint protocolVersion, uint requestId, Action<SftpStatusResponse> statusAction)
 3184231        {
 3184232            RequestId = requestId;
 3184233            ProtocolVersion = protocolVersion;
 3184234            _statusAction = statusAction;
 3184235        }
 36
 37        public virtual void Complete(SftpResponse response)
 1517638        {
 1517639            if (response is SftpStatusResponse statusResponse)
 1517640            {
 1517641                _statusAction(statusResponse);
 1517642            }
 43            else
 044            {
 045                throw new InvalidOperationException(string.Format("Response of type '{0}' is not expected.", response.Ge
 46            }
 1517647        }
 48
 49        protected override void LoadData()
 050        {
 051            throw new InvalidOperationException("Request cannot be saved.");
 52        }
 53
 54        protected override void SaveData()
 3165655        {
 3165656            base.SaveData();
 57
 3165658            Write(RequestId);
 3165659        }
 60    }
 61}