public void TestIsWellFormedPath(string path, PathKind pathState) { switch (pathState) { case PathKind.Throws: Assert.Throws <ArgumentException>(() => PathHelper.IsWellFormedPath(path)); Assert.Throws <ArgumentException>(() => PathHelper.IsWellFormedAbsolutePath(path)); Assert.Throws <ArgumentException>(() => PathHelper.IsWellFormedRelativePath(path)); Assert.Throws <ArgumentException>(() => PathHelper.IsWellFormedContainerPath(path)); Assert.Throws <ArgumentException>(() => PathHelper.IsWellFormedFileName(path)); break; case PathKind.Invalid: Assert.AreEqual(PathHelper.IsWellFormedPath(path), false); Assert.AreEqual(PathHelper.IsWellFormedAbsolutePath(path), false); Assert.AreEqual(PathHelper.IsWellFormedRelativePath(path), false); Assert.AreEqual(PathHelper.IsWellFormedContainerPath(path), false); Assert.AreEqual(PathHelper.IsWellFormedFileName(path), false); break; case PathKind.ValidAbsolutePath: Assert.AreEqual(PathHelper.IsWellFormedPath(path), true); Assert.AreEqual(PathHelper.IsWellFormedAbsolutePath(path), true); Assert.AreEqual(PathHelper.IsWellFormedRelativePath(path), false); Assert.AreEqual(PathHelper.IsWellFormedContainerPath(path), false); Assert.AreEqual(PathHelper.IsWellFormedFileName(path), false); break; case PathKind.ValidAbsoluteContainerPath: Assert.AreEqual(PathHelper.IsWellFormedPath(path), true); Assert.AreEqual(PathHelper.IsWellFormedAbsolutePath(path), true); Assert.AreEqual(PathHelper.IsWellFormedRelativePath(path), false); Assert.AreEqual(PathHelper.IsWellFormedContainerPath(path), true); Assert.AreEqual(PathHelper.IsWellFormedFileName(path), false); break; case PathKind.ValidRelativePath: Assert.AreEqual(PathHelper.IsWellFormedPath(path), true); Assert.AreEqual(PathHelper.IsWellFormedAbsolutePath(path), false); Assert.AreEqual(PathHelper.IsWellFormedRelativePath(path), true); Assert.AreEqual(PathHelper.IsWellFormedContainerPath(path), false); Assert.AreEqual(PathHelper.IsWellFormedFileName(path), false); break; case PathKind.ValidRelativeContainerPath: Assert.AreEqual(PathHelper.IsWellFormedPath(path), true); Assert.AreEqual(PathHelper.IsWellFormedAbsolutePath(path), false); Assert.AreEqual(PathHelper.IsWellFormedRelativePath(path), true); Assert.AreEqual(PathHelper.IsWellFormedContainerPath(path), true); Assert.AreEqual(PathHelper.IsWellFormedFileName(path), false); break; case PathKind.ValidFileName: Assert.AreEqual(PathHelper.IsWellFormedPath(path), true); Assert.AreEqual(PathHelper.IsWellFormedAbsolutePath(path), false); Assert.AreEqual(PathHelper.IsWellFormedRelativePath(path), true); Assert.AreEqual(PathHelper.IsWellFormedContainerPath(path), false); Assert.AreEqual(PathHelper.IsWellFormedFileName(path), true); break; default: throw new ArgumentOutOfRangeException(nameof(pathState), pathState, null); } }