public void Should_Collapse_Single_Dot(string uncollapsedPath, string collapsedPath) { // Given, When var path = PathCollapser.Collapse(new DirectoryPath(uncollapsedPath)); // Then Assert.AreEqual(collapsedPath, path); }
public void Should_Throw_If_Path_Is_Null() { // Given, When var result = Record.Exception(() => PathCollapser.Collapse(null)); // Then Assert.IsArgumentNullException(result, "path"); }
public void Should_Collapse_Single_Dot_To_Single_Dot(string uncollapsedPath) { // Given, When var path = PathCollapser.Collapse(new DirectoryPath(uncollapsedPath)); // Then path.ShouldBe("."); }
public void Should_Collapse_Single_Dot_With_Ellipsis() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("./..")); // Then Assert.AreEqual(".", path); }
public void Should_Collapse_Path_With_Separated_Ellipsis() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("hello/temp/../temp2/../world")); // Then Assert.Equal("hello/world", path); }
public void Should_Collapse_Single_Dot_With_Ellipsis() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("./..")); // Then path.ShouldBe("."); }
public void Should_Collapse_Path_With_Windows_Root() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("c:/hello/temp/test/../../world")); // Then path.ShouldBe("c:/hello/world"); }
public void Should_Stop_Collapsing_When_Windows_Root_Is_Reached() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("c:/../../../../../../temp")); // Then path.ShouldBe("c:/temp"); }
public void Should_Collapse_Path_With_Non_Windows_Root() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("/hello/temp/test/../../world")); // Then Assert.Equal("/hello/world", path); }
public void Should_Collapse_Relative_Path() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("hello/temp/test/../../world")); // Then Assert.Equal("hello/world", path); }
public void Should_Stop_Collapsing_When_Root_Is_Reached() { // Given, When var path = PathCollapser.Collapse(new DirectoryPath("/hello/../../../../../../temp")); // Then Assert.Equal("/temp", path); }
public void Should_Throw_If_Path_Is_Null() { // Given, When var result = Assert.Catch(() => PathCollapser.Collapse(null)); // Then Assert.That(result, Is.TypeOf <ArgumentNullException>()); Assert.That(((ArgumentNullException)result).ParamName, Is.EqualTo("path")); }
public void Should_Collapse_Ellipsis(string input, string expected) { // Given, When var path = PathCollapser.Collapse(new DirectoryPath(input)); // Then Assert.Equal(expected, path); }
public void Should_Throw_If_Path_Is_Null() { // Given, When var result = Record.Exception(() => PathCollapser.Collapse(null)); // Then result.ShouldBeOfType <ArgumentNullException>() .And().ParamName.ShouldBe("path"); }
public void Should_Collapse_To_Dot_When_Only_One_Folder_Is_Followed_By_Ellipsis(string input, string expected) { // Given, When var path = PathCollapser.Collapse(new DirectoryPath(input)); // Then Assert.Equal(expected, path); }
public void Should_Throw_If_Path_Is_Null() { // Given, When var result = Record.Exception(() => PathCollapser.Collapse(null)); // Then Assert.IsType <ArgumentNullException>(result); Assert.Equal("path", ((ArgumentNullException)result).ParamName); }
/// <summary> /// Collapses a <see cref="FilePath"/> containing ellipses. /// </summary> /// <returns>A collapsed <see cref="FilePath"/>.</returns> public FilePath Collapse() { return(new FilePath(PathCollapser.Collapse(this))); }
/// <summary> /// Collapses a <see cref="DirectoryPath"/> containing ellipses. /// </summary> /// <returns>A collapsed <see cref="DirectoryPath"/>.</returns> public DirectoryPath Collapse() { return(new DirectoryPath(PathCollapser.Collapse(this))); }
/// <summary> /// Collapses a <see cref="Path"/> containing ellipses. /// </summary> /// <returns>A collapsed <see cref="Path"/>.</returns> public Path Collapse() { return(new Path(PathCollapser.Collapse(this))); }