# < Summary

Information

Class: | Renci.SshNet.Messages.Transport.DisconnectMessage
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Transport\DisconnectMessage.cs

Line coverage
100%

Covered lines: | 36
Uncovered lines: | 0
Coverable lines: | 36
Total lines: | 99
Line coverage: | 100%

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

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_ReasonCode() | 100% | 1 | 100%
get_Description() | 100% | 1 | 100%
set_Description(...) | 100% | 1 | 100%
get_Language() | 100% | 1 | 100%
set_Language(...) | 100% | 1 | 100%
get_BufferCapacity() | 100% | 1 | 100%
.ctor() | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
LoadData() | 100% | 1 | 100%
SaveData() | 100% | 1 | 100%
Process(...) | 100% | 1 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Transport\DisconnectMessage.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `namespace Renci.SshNet.Messages.Transport`
|  | `2` |  | `{`
|  | `3` |  | `/// <summary>`
|  | `4` |  | `/// Represents SSH_MSG_DISCONNECT message.`
|  | `5` |  | `/// </summary>`
|  | `6` |  | `[Message("SSH_MSG_DISCONNECT", 1)]`
|  | `7` |  | `public class DisconnectMessage : Message, IKeyExchangedAllowed`
|  | `8` |  | `{`
|  | `9` |  | `private byte[] _description;`
|  | `10` |  | `private byte[] _language;`
|  | `11` |  | ``
|  | `12` |  | `/// <summary>`
|  | `13` |  | `/// Gets disconnect reason code.`
|  | `14` |  | `/// </summary>`
| 4111 | `15` |  | `public DisconnectReason ReasonCode { get; private set; }`
|  | `16` |  | ``
|  | `17` |  | `/// <summary>`
|  | `18` |  | `/// Gets disconnect description.`
|  | `19` |  | `/// </summary>`
|  | `20` |  | `public string Description`
|  | `21` |  | `{`
| 1197 | `22` |  | `get { return Utf8.GetString(_description, 0, _description.Length); }`
| 5001 | `23` |  | `private set { _description = Utf8.GetBytes(value); }`
|  | `24` |  | `}`
|  | `25` |  | ``
|  | `26` |  | `/// <summary>`
|  | `27` |  | `/// Gets message language.`
|  | `28` |  | `/// </summary>`
|  | `29` |  | `public string Language`
|  | `30` |  | `{`
| 18 | `31` |  | `get { return Utf8.GetString(_language, 0, _language.Length); }`
| 5001 | `32` |  | `private set { _language = Utf8.GetBytes(value); }`
|  | `33` |  | `}`
|  | `34` |  | ``
|  | `35` |  | `/// <summary>`
|  | `36` |  | `/// Gets the size of the message in bytes.`
|  | `37` |  | `/// </summary>`
|  | `38` |  | `/// <value>`
|  | `39` |  | `/// The size of the messages in bytes.`
|  | `40` |  | `/// </value>`
|  | `41` |  | `protected override int BufferCapacity`
|  | `42` |  | `{`
|  | `43` |  | `get`
| 1667 | `44` |  | `{`
| 1667 | `45` |  | `var capacity = base.BufferCapacity;`
| 1667 | `46` |  | `capacity += 4; // ReasonCode`
| 1667 | `47` |  | `capacity += 4; // Description length`
| 1667 | `48` |  | `capacity += _description.Length; // Description`
| 1667 | `49` |  | `capacity += 4; // Language length`
| 1667 | `50` |  | `capacity += _language.Length; // Language`
| 1667 | `51` |  | `return capacity;`
| 1667 | `52` |  | `}`
|  | `53` |  | `}`
|  | `54` |  | ``
|  | `55` |  | `/// <summary>`
|  | `56` |  | `/// Initializes a new instance of the <see cref="DisconnectMessage"/> class.`
|  | `57` |  | `/// </summary>`
| 189 | `58` |  | `public DisconnectMessage()`
| 189 | `59` |  | `{`
| 189 | `60` |  | `}`
|  | `61` |  | ``
|  | `62` |  | `/// <summary>`
|  | `63` |  | `/// Initializes a new instance of the <see cref="DisconnectMessage"/> class.`
|  | `64` |  | `/// </summary>`
|  | `65` |  | `/// <param name="reasonCode">The reason code.</param>`
|  | `66` |  | `/// <param name="message">The message.</param>`
| 1667 | `67` |  | `public DisconnectMessage(DisconnectReason reasonCode, string message)`
| 1667 | `68` |  | `{`
| 1667 | `69` |  | `ReasonCode = reasonCode;`
| 1667 | `70` |  | `Description = message;`
| 1667 | `71` |  | `Language = "en";`
| 1667 | `72` |  | `}`
|  | `73` |  | ``
|  | `74` |  | `/// <summary>`
|  | `75` |  | `/// Called when type specific data need to be loaded.`
|  | `76` |  | `/// </summary>`
|  | `77` |  | `protected override void LoadData()`
| 189 | `78` |  | `{`
| 189 | `79` |  | `ReasonCode = (DisconnectReason) ReadUInt32();`
| 189 | `80` |  | `_description = ReadBinary();`
| 189 | `81` |  | `_language = ReadBinary();`
| 189 | `82` |  | `}`
|  | `83` |  | ``
|  | `84` |  | `/// <summary>`
|  | `85` |  | `/// Called when type specific data need to be saved.`
|  | `86` |  | `/// </summary>`
|  | `87` |  | `protected override void SaveData()`
| 1667 | `88` |  | `{`
| 1667 | `89` |  | `Write((uint) ReasonCode);`
| 1667 | `90` |  | `WriteBinaryString(_description);`
| 1667 | `91` |  | `WriteBinaryString(_language);`
| 1667 | `92` |  | `}`
|  | `93` |  | ``
|  | `94` |  | `internal override void Process(Session session)`
| 189 | `95` |  | `{`
| 189 | `96` |  | `session.OnDisconnectReceived(this);`
| 189 | `97` |  | `}`
|  | `98` |  | `}`
|  | `99` |  | `}`

# Methods/Properties

get_ReasonCode()
get_Description()
set_Description(System.String)
get_Language()
set_Language(System.String)
get_BufferCapacity()
.ctor()
.ctor(Renci.SshNet.Messages.Transport.DisconnectReason,System.String)
LoadData()
SaveData()
Process(Renci.SshNet.Session)