# ICSharpCode.SharpZipLib.Core.WindowsPathUtils - Coverage Report

# Summary

Class: | ICSharpCode.SharpZipLib.Core.WindowsPathUtils
Assembly: | ICSharpCode.SharpZipLib
File(s): | C:\Users\Neil\Documents\Visual Studio 2015\Projects\icsharpcode\SZL_master\ICSharpCode.SharpZipLib\Core\WindowsPathUtils.cs
Covered lines: | 19
Uncovered lines: | 3
Coverable lines: | 22
Total lines: | 57
Line coverage: | 86.3%
Branch coverage: | 76.6%

# Metrics

Method | Cyclomatic Complexity | Sequence Coverage | Branch Coverage
--- | --- | --- | ---
.ctor() | 1 | 0 | 0
DropPathRoot(...) | 17 | 90 | 77.42

# File(s)

## C:\Users\Neil\Documents\Visual Studio 2015\Projects\icsharpcode\SZL_master\ICSharpCode.SharpZipLib\Core\WindowsPathUtils.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `namespace ICSharpCode.SharpZipLib.Core`
|  | `2` |  | `{`
|  | `3` |  | `/// <summary>`
|  | `4` |  | `/// WindowsPathUtils provides simple utilities for handling windows paths.`
|  | `5` |  | `/// </summary>`
|  | `6` |  | `public abstract class WindowsPathUtils`
|  | `7` |  | `{`
|  | `8` |  | `/// <summary>`
|  | `9` |  | `/// Initializes a new instance of the <see cref="WindowsPathUtils"/> class.`
|  | `10` |  | `/// </summary>`
| 0 | `11` |  | `internal WindowsPathUtils()`
|  | `12` |  | `{`
| 0 | `13` |  | `}`
|  | `14` |  | ``
|  | `15` |  | `/// <summary>`
|  | `16` |  | `/// Remove any path root present in the path`
|  | `17` |  | `/// </summary>`
|  | `18` |  | `/// <param name="path">A <see cref="string"/> containing path information.</param>`
|  | `19` |  | `/// <returns>The path with the root removed if it was present; path otherwise.</returns>`
|  | `20` |  | `/// <remarks>Unlike the <see cref="System.IO.Path"/> class the path isnt otherwise checked for validity.</remarks>`
|  | `21` |  | `public static string DropPathRoot(string path)`
|  | `22` |  | `{`
| 65930 | `23` |  | `string result = path;`
|  | `24` |  | ``
| 65930 | `25` |  | `if (!string.IsNullOrEmpty(path)) {`
| 65930 | `26` |  | `if ((path[0] == '\\') || (path[0] == '/')) {`
|  | `27` |  | `// UNC name ?`
| 6 | `28` |  | `if ((path.Length > 1) && ((path[1] == '\\') || (path[1] == '/'))) {`
| 1 | `29` |  | `int index = 2;`
| 1 | `30` |  | `int elements = 2;`
|  | `31` |  | ``
|  | `32` |  | `// Scan for two separate elements \\machine\share\restofpath`
| 11 | `33` |  | `while ((index <= path.Length) &&`
| 11 | `34` |  | `(((path[index] != '\\') && (path[index] != '/')) || (--elements > 0))) {`
| 10 | `35` |  | `index++;`
|  | `36` |  | `}`
|  | `37` |  | ``
| 1 | `38` |  | `index++;`
|  | `39` |  | ``
| 1 | `40` |  | `if (index < path.Length) {`
| 1 | `41` |  | `result = path.Substring(index);`
| 1 | `42` |  | `} else {`
| 0 | `43` |  | `result = "";`
|  | `44` |  | `}`
|  | `45` |  | `}`
| 65924 | `46` |  | `} else if ((path.Length > 1) && (path[1] == ':')) {`
| 10 | `47` |  | `int dropCount = 2;`
| 10 | `48` |  | `if ((path.Length > 2) && ((path[2] == '\\') || (path[2] == '/'))) {`
| 9 | `49` |  | `dropCount = 3;`
|  | `50` |  | `}`
| 10 | `51` |  | `result = result.Remove(0, dropCount);`
|  | `52` |  | `}`
|  | `53` |  | `}`
| 65930 | `54` |  | `return result;`
|  | `55` |  | `}`
|  | `56` |  | `}`
|  | `57` |  | `}`