< Summary

Information
Class: Renci.SshNet.Connection.SshIdentification
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Connection\SshIdentification.cs
Line coverage
100%
Covered lines: 26
Uncovered lines: 0
Coverable lines: 26
Total lines: 99
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
.ctor(...)100%4100%
get_SoftwareVersion()100%1100%
get_ProtocolVersion()100%1100%
get_Comments()100%1100%
ToString()100%2100%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Connection\SshIdentification.cs

#LineLine coverage
 1using System;
 2
 3namespace Renci.SshNet.Connection
 4{
 5    /// <summary>
 6    /// Represents an SSH identification.
 7    /// </summary>
 8    public sealed class SshIdentification
 9    {
 10        /// <summary>
 11        /// Initializes a new instance of the <see cref="SshIdentification"/> class with the specified protocol version
 12        /// and software version.
 13        /// </summary>
 14        /// <param name="protocolVersion">The SSH protocol version.</param>
 15        /// <param name="softwareVersion">The software version of the implementation.</param>
 16        /// <exception cref="ArgumentNullException"><paramref name="protocolVersion"/> is <see langword="null"/>.</excep
 17        /// <exception cref="ArgumentNullException"><paramref name="softwareVersion"/> is <see langword="null"/>.</excep
 18        public SshIdentification(string protocolVersion, string softwareVersion)
 66619            : this(protocolVersion, softwareVersion, comments: null)
 66020        {
 66021        }
 22
 23        /// <summary>
 24        /// Initializes a new instance of the <see cref="SshIdentification"/> class with the specified protocol version,
 25        /// software version and comments.
 26        /// </summary>
 27        /// <param name="protocolVersion">The SSH protocol version.</param>
 28        /// <param name="softwareVersion">The software version of the implementation.</param>
 29        /// <param name="comments">The comments.</param>
 30        /// <exception cref="ArgumentNullException"><paramref name="protocolVersion"/> is <see langword="null"/>.</excep
 31        /// <exception cref="ArgumentNullException"><paramref name="softwareVersion"/> is <see langword="null"/>.</excep
 191932        public SshIdentification(string protocolVersion, string softwareVersion, string comments)
 191933        {
 191934            if (protocolVersion is null)
 635            {
 636                throw new ArgumentNullException(nameof(protocolVersion));
 37            }
 38
 191339            if (softwareVersion is null)
 640            {
 641                throw new ArgumentNullException(nameof(softwareVersion));
 42            }
 43
 190744            ProtocolVersion = protocolVersion;
 190745            SoftwareVersion = softwareVersion;
 190746            Comments = comments;
 190747        }
 48
 49        /// <summary>
 50        /// Gets the software version of the implementation.
 51        /// </summary>
 52        /// <value>
 53        /// The software version of the implementation.
 54        /// </value>
 55        /// <remarks>
 56        /// This is primarily used to trigger compatibility extensions and to indicate
 57        /// the capabilities of an implementation.
 58        /// </remarks>
 375159        public string SoftwareVersion { get; }
 60
 61        /// <summary>
 62        /// Gets the SSH protocol version.
 63        /// </summary>
 64        /// <value>
 65        /// The SSH protocol version.
 66        /// </value>
 547867        public string ProtocolVersion { get; }
 68
 69        /// <summary>
 70        /// Gets the comments.
 71        /// </summary>
 72        /// <value>
 73        /// The comments, or <see langword="null"/> if there are no comments.
 74        /// </value>
 75        /// <remarks>
 76        /// <see cref="Comments"/> should contain additional information that might be useful
 77        /// in solving user problems.
 78        /// </remarks>
 366479        public string Comments { get; }
 80
 81        /// <summary>
 82        /// Returns the SSH identification string.
 83        /// </summary>
 84        /// <returns>
 85        /// The SSH identification string.
 86        /// </returns>
 87        public override string ToString()
 364388        {
 364389            var identificationString = "SSH-" + ProtocolVersion + "-" + SoftwareVersion;
 90
 364391            if (Comments != null)
 392            {
 393                identificationString += " " + Comments;
 394            }
 95
 364396            return identificationString;
 364397        }
 98    }
 99}