public void TryParse_UnixPath_Failure(string path) { bool success = PathComponents.TryParse(path, out var result); Assert.IsFalse(success); // Assert.IsNull(result); // value of result when TryParse returns false is undefined behavior }
public void TryParse_EmptyString() { bool success = PathComponents.TryParse(string.Empty, out var result); Assert.IsTrue(success); Assert.IsNull(result.DriveLetter); CollectionAssert.IsEmpty(result.Components); }
public void TryParse_UnixPath_Success(string path, char?drive, string components) { bool success = PathComponents.TryParse(path, out var result); Assert.IsTrue(success); Assert.IsNotNull(result); Assert.AreEqual(drive, result.DriveLetter); CollectionAssert.AreEqual(components.Split(',', StringSplitOptions.RemoveEmptyEntries), result.Components); }
public void TryParse_NullPath() { Assert.Throws <ArgumentNullException>(() => PathComponents.TryParse(null, out _)); }