# < Summary

Information

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

Line coverage
100%

Covered lines: | 17
Uncovered lines: | 0
Coverable lines: | 17
Total lines: | 77
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

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
Transform(...) | 100% | 6 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.Text;`
|  | `3` |  | ``
|  | `4` |  | `namespace Renci.SshNet`
|  | `5` |  | `{`
|  | `6` |  | `/// <summary>`
|  | `7` |  | `/// Encloses a path in double quotes, and escapes any embedded double quote with a backslash.`
|  | `8` |  | `/// </summary>`
|  | `9` |  | `internal sealed class RemotePathDoubleQuoteTransformation : IRemotePathTransformation`
|  | `10` |  | `{`
|  | `11` |  | `/// <summary>`
|  | `12` |  | `/// Encloses a path in double quotes, and escapes any embedded double quote with a backslash.`
|  | `13` |  | `/// </summary>`
|  | `14` |  | `/// <param name="path">The path to transform.</param>`
|  | `15` |  | `/// <returns>`
|  | `16` |  | `/// The transformed path.`
|  | `17` |  | `/// </returns>`
|  | `18` |  | `/// <exception cref="ArgumentNullException"><paramref name="path"/> is <see langword="null"/>.</exception>`
|  | `19` |  | `/// <example>`
|  | `20` |  | `/// <list type="table">`
|  | `21` |  | `/// <listheader>`
|  | `22` |  | `/// <term>Original</term>`
|  | `23` |  | `/// <term>Transformed</term>`
|  | `24` |  | `/// </listheader>`
|  | `25` |  | `/// <item>`
|  | `26` |  | `/// <term>/var/log/auth.log</term>`
|  | `27` |  | `/// <term>&quot;/var/log/auth.log&quot;</term>`
|  | `28` |  | `/// </item>`
|  | `29` |  | `/// <item>`
|  | `30` |  | `/// <term>/var/mp3/Guns N' Roses</term>`
|  | `31` |  | `/// <term>&quot;/var/mp3/Guns N' Roses&quot;</term>`
|  | `32` |  | `/// </item>`
|  | `33` |  | `/// <item>`
|  | `34` |  | `/// <term>/var/garbage!/temp</term>`
|  | `35` |  | `/// <term>&quot;/var/garbage!/temp&quot;</term>`
|  | `36` |  | `/// </item>`
|  | `37` |  | `/// <item>`
|  | `38` |  | `/// <term>/var/would be 'kewl'!/not?</term>`
|  | `39` |  | `/// <term>&quot;/var/would be 'kewl'!, not?&quot;</term>`
|  | `40` |  | `/// </item>`
|  | `41` |  | `/// <item>`
|  | `42` |  | `/// <term></term>`
|  | `43` |  | `/// <term>&quot;&quot;</term>`
|  | `44` |  | `/// </item>`
|  | `45` |  | `/// <item>`
|  | `46` |  | `/// <term>Hello &quot;World&quot;</term>`
|  | `47` |  | `/// <term>&quot;Hello \&quot;World&quot;</term>`
|  | `48` |  | `/// </item>`
|  | `49` |  | `/// </list>`
|  | `50` |  | `/// </example>`
|  | `51` |  | `public string Transform(string path)`
| 679 | `52` |  | `{`
| 679 | `53` |  | `if (path is null)`
| 3 | `54` |  | `{`
| 3 | `55` |  | `throw new ArgumentNullException(nameof(path));`
|  | `56` |  | `}`
|  | `57` |  | ``
| 676 | `58` |  | `var transformed = new StringBuilder(path.Length);`
|  | `59` |  | ``
| 676 | `60` |  | `_ = transformed.Append('"');`
|  | `61` |  | ``
| 14706 | `62` |  | `foreach (var c in path)`
| 6339 | `63` |  | `{`
| 6339 | `64` |  | `if (c == '"')`
| 21 | `65` |  | `{`
| 21 | `66` |  | `_ = transformed.Append('\\');`
| 21 | `67` |  | `}`
|  | `68` |  | ``
| 6339 | `69` |  | `_ = transformed.Append(c);`
| 6339 | `70` |  | `}`
|  | `71` |  | ``
| 676 | `72` |  | `_ = transformed.Append('"');`
|  | `73` |  | ``
| 676 | `74` |  | `return transformed.ToString();`
| 676 | `75` |  | `}`
|  | `76` |  | `}`
|  | `77` |  | `}`

# Methods/Properties

Transform(System.String)