< Summary

Information
Class: Renci.SshNet.Messages.Authentication.BannerMessage
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\BannerMessage.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 70
Line coverage: 0%
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_Message()100%10%
get_Language()100%10%
get_BufferCapacity()100%10%
Process(...)100%10%
LoadData()100%10%
SaveData()100%10%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\BannerMessage.cs

#LineLine coverage
 1namespace Renci.SshNet.Messages.Authentication
 2{
 3    /// <summary>
 4    /// Represents SSH_MSG_USERAUTH_BANNER message.
 5    /// </summary>
 6    [Message("SSH_MSG_USERAUTH_BANNER", 53)]
 7    public class BannerMessage : Message
 8    {
 9        private byte[] _message;
 10        private byte[] _language;
 11
 12        /// <summary>
 13        /// Gets banner message.
 14        /// </summary>
 15        public string Message
 16        {
 017            get { return Utf8.GetString(_message, 0, _message.Length); }
 18        }
 19
 20        /// <summary>
 21        /// Gets banner language.
 22        /// </summary>
 23        public string Language
 24        {
 025            get { return Utf8.GetString(_language, 0, _language.Length); }
 26        }
 27
 28        /// <summary>
 29        /// Gets the size of the message in bytes.
 30        /// </summary>
 31        /// <value>
 32        /// The size of the messages in bytes.
 33        /// </value>
 34        protected override int BufferCapacity
 35        {
 36            get
 037            {
 038                var capacity = base.BufferCapacity;
 039                capacity += 4; // Message length
 040                capacity += _message.Length; // Message
 041                capacity += 4; // Language length
 042                capacity += _language.Length; // Language
 043                return capacity;
 044            }
 45        }
 46
 47        internal override void Process(Session session)
 048        {
 049            session.OnUserAuthenticationBannerReceived(this);
 050        }
 51
 52        /// <summary>
 53        /// Called when type specific data need to be loaded.
 54        /// </summary>
 55        protected override void LoadData()
 056        {
 057            _message = ReadBinary();
 058            _language = ReadBinary();
 059        }
 60
 61        /// <summary>
 62        /// Called when type specific data need to be saved.
 63        /// </summary>
 64        protected override void SaveData()
 065        {
 066            WriteBinaryString(_message);
 067            WriteBinaryString(_language);
 068        }
 69    }
 70}