< Summary

Information
Class: Renci.SshNet.Messages.Connection.ExitSignalRequestInfo
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Connection\ChannelRequest\ExitSignalRequestInfo.cs
Line coverage
27%
Covered lines: 12
Uncovered lines: 32
Coverable lines: 44
Total lines: 132
Line coverage: 27.2%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_RequestName()100%10%
get_SignalName()100%10%
set_SignalName(...)100%10%
get_CoreDumped()100%1100%
get_ErrorMessage()100%10%
set_ErrorMessage(...)100%10%
get_Language()100%10%
set_Language(...)100%10%
get_BufferCapacity()100%10%
.ctor()100%1100%
.ctor(...)100%10%
LoadData()100%1100%
SaveData()100%10%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Connection\ChannelRequest\ExitSignalRequestInfo.cs

#LineLine coverage
 1namespace Renci.SshNet.Messages.Connection
 2{
 3    /// <summary>
 4    /// Represents "exit-signal" type channel request information.
 5    /// </summary>
 6    internal sealed class ExitSignalRequestInfo : RequestInfo
 7    {
 8        private byte[] _signalName;
 9        private byte[] _errorMessage;
 10        private byte[] _language;
 11
 12        /// <summary>
 13        /// Channel request name.
 14        /// </summary>
 15        public const string Name = "exit-signal";
 16
 17        /// <summary>
 18        /// Gets the name of the request.
 19        /// </summary>
 20        /// <value>
 21        /// The name of the request.
 22        /// </value>
 23        public override string RequestName
 24        {
 025            get { return Name; }
 26        }
 27
 28        /// <summary>
 29        /// Gets the name of the signal.
 30        /// </summary>
 31        /// <value>
 32        /// The name of the signal.
 33        /// </value>
 34        public string SignalName
 35        {
 036            get { return Ascii.GetString(_signalName, 0, _signalName.Length); }
 037            private set { _signalName = Ascii.GetBytes(value); }
 38        }
 39
 40        /// <summary>
 41        /// Gets a value indicating whether core is dumped.
 42        /// </summary>
 43        /// <value>
 44        /// <see langword="true"/> if core is dumped; otherwise, <see langword="false"/>.
 45        /// </value>
 546        public bool CoreDumped { get; private set; }
 47
 48        /// <summary>
 49        /// Gets the error message.
 50        /// </summary>
 51        public string ErrorMessage
 52        {
 053            get { return Utf8.GetString(_errorMessage, 0, _errorMessage.Length); }
 054            private set { _errorMessage = Utf8.GetBytes(value); }
 55        }
 56
 57        /// <summary>
 58        /// Gets message language.
 59        /// </summary>
 60        public string Language
 61        {
 062            get { return Utf8.GetString(_language, 0, _language.Length); }
 063            private set { _language = Utf8.GetBytes(value); }
 64        }
 65
 66        protected override int BufferCapacity
 67        {
 68            get
 069            {
 070                var capacity = base.BufferCapacity;
 071                capacity += 4; // SignalName length
 072                capacity += _signalName.Length; // SignalName
 073                capacity += 1; // CoreDumped
 074                capacity += 4; // ErrorMessage length
 075                capacity += _errorMessage.Length; // ErrorMessage
 076                capacity += 4; // Language length
 077                capacity += _language.Length; // Language
 078                return capacity;
 079            }
 80        }
 81
 82        /// <summary>
 83        /// Initializes a new instance of the <see cref="ExitSignalRequestInfo"/> class.
 84        /// </summary>
 280485        public ExitSignalRequestInfo()
 280486        {
 280487            WantReply = false;
 280488        }
 89
 90        /// <summary>
 91        /// Initializes a new instance of the <see cref="ExitSignalRequestInfo"/> class.
 92        /// </summary>
 93        /// <param name="signalName">Name of the signal.</param>
 94        /// <param name="coreDumped">if set to <see langword="true"/> then core is dumped.</param>
 95        /// <param name="errorMessage">The error message.</param>
 96        /// <param name="language">The language.</param>
 97        public ExitSignalRequestInfo(string signalName, bool coreDumped, string errorMessage, string language)
 098            : this()
 099        {
 0100            SignalName = signalName;
 0101            CoreDumped = coreDumped;
 0102            ErrorMessage = errorMessage;
 0103            Language = language;
 0104        }
 105
 106        /// <summary>
 107        /// Called when type specific data need to be loaded.
 108        /// </summary>
 109        protected override void LoadData()
 5110        {
 5111            base.LoadData();
 112
 5113            _signalName = ReadBinary();
 5114            CoreDumped = ReadBoolean();
 5115            _errorMessage = ReadBinary();
 5116            _language = ReadBinary();
 5117        }
 118
 119        /// <summary>
 120        /// Called when type specific data need to be saved.
 121        /// </summary>
 122        protected override void SaveData()
 0123        {
 0124            base.SaveData();
 125
 0126            WriteBinaryString(_signalName);
 0127            Write(CoreDumped);
 0128            Write(_errorMessage);
 0129            Write(_language);
 0130        }
 131    }
 132}