< Summary

Information
Class: Renci.SshNet.Sftp.Requests.SftpSetStatRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\SftpSetStatRequest.cs
Line coverage
84%
Covered lines: 27
Uncovered lines: 5
Coverable lines: 32
Total lines: 77
Line coverage: 84.3%
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_Path()100%1100%
set_Path(...)100%1100%
get_Encoding()100%1100%
get_Attributes()100%1100%
get_AttributesBytes()100%2100%
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\SftpSetStatRequest.cs

#LineLine coverage
 1using System;
 2using System.Text;
 3using Renci.SshNet.Sftp.Responses;
 4
 5namespace Renci.SshNet.Sftp.Requests
 6{
 7    internal sealed class SftpSetStatRequest : SftpRequest
 8    {
 9        private byte[] _path;
 10        private byte[] _attributesBytes;
 11
 12        public override SftpMessageTypes SftpMessageType
 13        {
 3314            get { return SftpMessageTypes.SetStat; }
 15        }
 16
 17        public string Path
 18        {
 919            get { return Encoding.GetString(_path, 0, _path.Length); }
 4220            private set { _path = Encoding.GetBytes(value); }
 21        }
 22
 3423        public Encoding Encoding { get; private set; }
 24
 2225        private SftpFileAttributes Attributes { get; set; }
 26
 27        private byte[] AttributesBytes
 28        {
 29            get
 1630            {
 1631                _attributesBytes ??= Attributes.GetBytes();
 32
 1633                return _attributesBytes;
 1634            }
 35        }
 36
 37        /// <summary>
 38        /// Gets the size of the message in bytes.
 39        /// </summary>
 40        /// <value>
 41        /// The size of the messages in bytes.
 42        /// </value>
 43        protected override int BufferCapacity
 44        {
 45            get
 846            {
 847                var capacity = base.BufferCapacity;
 848                capacity += 4; // Path length
 849                capacity += _path.Length; // Path
 850                capacity += AttributesBytes.Length; // Attributes
 851                return capacity;
 852            }
 53        }
 54
 55        public SftpSetStatRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, SftpFileAttribut
 1456            : base(protocolVersion, requestId, statusAction)
 1457        {
 1458            Encoding = encoding;
 1459            Path = path;
 1460            Attributes = attributes;
 1461        }
 62
 63        protected override void LoadData()
 064        {
 065            base.LoadData();
 066            _path = ReadBinary();
 067            Attributes = ReadAttributes();
 068        }
 69
 70        protected override void SaveData()
 871        {
 872            base.SaveData();
 873            WriteBinaryString(_path);
 874            Write(AttributesBytes);
 875        }
 76    }
 77}