< Summary

Information
Class: Renci.SshNet.Sftp.Requests.SftpMkDirRequest
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Requests\SftpMkDirRequest.cs
Line coverage
85%
Covered lines: 30
Uncovered lines: 5
Coverable lines: 35
Total lines: 82
Line coverage: 85.7%
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%
.ctor(...)100%1100%
LoadData()100%10%
SaveData()100%1100%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Text;
 3using Renci.SshNet.Sftp.Responses;
 4
 5namespace Renci.SshNet.Sftp.Requests
 6{
 7    internal sealed class SftpMkDirRequest : SftpRequest
 8    {
 9        private byte[] _path;
 10        private byte[] _attributesBytes;
 11
 12        public override SftpMessageTypes SftpMessageType
 13        {
 3012914            get { return SftpMessageTypes.MkDir; }
 15        }
 16
 17        public string Path
 18        {
 919            get { return Encoding.GetString(_path, 0, _path.Length); }
 3013820            private set { _path = Encoding.GetBytes(value); }
 21        }
 22
 2009823        public Encoding Encoding { get; private set; }
 24
 2008625        private SftpFileAttributes Attributes { get; set; }
 26
 27        private byte[] AttributesBytes
 28        {
 29            get
 2008030            {
 2008031                _attributesBytes ??= Attributes.GetBytes();
 32
 2008033                return _attributesBytes;
 2008034            }
 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
 1004046            {
 1004047                var capacity = base.BufferCapacity;
 1004048                capacity += 4; // Path length
 1004049                capacity += _path.Length; // Path
 1004050                capacity += AttributesBytes.Length; // Attributes
 1004051                return capacity;
 1004052            }
 53        }
 54
 55        public SftpMkDirRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action<SftpStatusR
 1004656            : this(protocolVersion, requestId, path, encoding, SftpFileAttributes.Empty, statusAction)
 1004657        {
 1004658        }
 59
 60        private SftpMkDirRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, SftpFileAttribute
 1004661            : base(protocolVersion, requestId, statusAction)
 1004662        {
 1004663            Encoding = encoding;
 1004664            Path = path;
 1004665            Attributes = attributes;
 1004666        }
 67
 68        protected override void LoadData()
 069        {
 070            base.LoadData();
 071            _path = ReadBinary();
 072            Attributes = ReadAttributes();
 073        }
 74
 75        protected override void SaveData()
 1004076        {
 1004077            base.SaveData();
 1004078            WriteBinaryString(_path);
 1004079            Write(AttributesBytes);
 1004080        }
 81    }
 82}