< Summary

Information
Class: Renci.SshNet.Messages.Authentication.InformationRequestMessage
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\InformationRequestMessage.cs
Line coverage
91%
Covered lines: 21
Uncovered lines: 2
Coverable lines: 23
Total lines: 72
Line coverage: 91.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_Name()100%1100%
get_Instruction()100%1100%
get_Language()100%1100%
get_Prompts()100%1100%
LoadData()100%2100%
SaveData()100%10%
Process(...)100%1100%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Text;
 4using Renci.SshNet.Common;
 5
 6namespace Renci.SshNet.Messages.Authentication
 7{
 8    /// <summary>
 9    /// Represents SSH_MSG_USERAUTH_INFO_REQUEST message.
 10    /// </summary>
 11    [Message("SSH_MSG_USERAUTH_INFO_REQUEST", 60)]
 12    internal sealed class InformationRequestMessage : Message
 13    {
 14        /// <summary>
 15        /// Gets information request name.
 16        /// </summary>
 917        public string Name { get; private set; }
 18
 19        /// <summary>
 20        /// Gets information request instruction.
 21        /// </summary>
 1822        public string Instruction { get; private set; }
 23
 24        /// <summary>
 25        /// Gets information request language.
 26        /// </summary>
 1827        public string Language { get; private set; }
 28
 29        /// <summary>
 30        /// Gets information request prompts.
 31        /// </summary>
 1832        public IEnumerable<AuthenticationPrompt> Prompts { get; private set; }
 33
 34        /// <summary>
 35        /// Called when type specific data need to be loaded.
 36        /// </summary>
 37        protected override void LoadData()
 938        {
 939            Name = ReadString(Encoding.UTF8);
 940            Instruction = ReadString(Encoding.UTF8);
 41
 42            // language tag as defined in rfc3066:
 43            // Language tags may always be presented using the characters A-Z, a-z, 0 - 9 and HYPHEN-MINUS
 944            Language = ReadString(Ascii);
 45
 946            var numOfPrompts = ReadUInt32();
 947            var prompts = new List<AuthenticationPrompt>();
 48
 3049            for (var i = 0; i < numOfPrompts; i++)
 650            {
 651                var prompt = ReadString(Encoding.UTF8);
 652                var echo = ReadBoolean();
 653                prompts.Add(new AuthenticationPrompt(i, echo, prompt));
 654            }
 55
 956            Prompts = prompts;
 957        }
 58
 59        /// <summary>
 60        /// Called when type specific data need to be saved.
 61        /// </summary>
 62        protected override void SaveData()
 063        {
 064            throw new NotImplementedException();
 65        }
 66
 67        internal override void Process(Session session)
 968        {
 969            session.OnUserAuthenticationInformationRequestReceived(this);
 970        }
 71    }
 72}