Esempio n. 1
0
            public void Should_Collapse_Single_Dot(string uncollapsedPath, string collapsedPath)
            {
                // Given, When
                var path = PathCollapser.Collapse(new DirectoryPath(uncollapsedPath));

                // Then
                Assert.AreEqual(collapsedPath, path);
            }
Esempio n. 2
0
            public void Should_Throw_If_Path_Is_Null()
            {
                // Given, When
                var result = Record.Exception(() => PathCollapser.Collapse(null));

                // Then
                Assert.IsArgumentNullException(result, "path");
            }
Esempio n. 3
0
            public void Should_Collapse_Single_Dot_To_Single_Dot(string uncollapsedPath)
            {
                // Given, When
                var path = PathCollapser.Collapse(new DirectoryPath(uncollapsedPath));

                // Then
                path.ShouldBe(".");
            }
Esempio n. 4
0
            public void Should_Collapse_Single_Dot_With_Ellipsis()
            {
                // Given, When
                var path = PathCollapser.Collapse(new DirectoryPath("./.."));

                // Then
                Assert.AreEqual(".", path);
            }
Esempio n. 5
0
            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);
            }
Esempio n. 6
0
            public void Should_Collapse_Single_Dot_With_Ellipsis()
            {
                // Given, When
                var path = PathCollapser.Collapse(new DirectoryPath("./.."));

                // Then
                path.ShouldBe(".");
            }
Esempio n. 7
0
            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");
            }
Esempio n. 8
0
            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");
            }
Esempio n. 9
0
            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);
            }
Esempio n. 10
0
            public void Should_Collapse_Relative_Path()
            {
                // Given, When
                var path = PathCollapser.Collapse(new DirectoryPath("hello/temp/test/../../world"));

                // Then
                Assert.Equal("hello/world", path);
            }
Esempio n. 11
0
            public void Should_Stop_Collapsing_When_Root_Is_Reached()
            {
                // Given, When
                var path = PathCollapser.Collapse(new DirectoryPath("/hello/../../../../../../temp"));

                // Then
                Assert.Equal("/temp", path);
            }
Esempio n. 12
0
            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"));
            }
Esempio n. 13
0
                public void Should_Collapse_Ellipsis(string input,
                                                     string expected)
                {
                    // Given, When
                    var path = PathCollapser.Collapse(new DirectoryPath(input));

                    // Then
                    Assert.Equal(expected, path);
                }
Esempio n. 14
0
            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");
            }
Esempio n. 15
0
                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);
                }
Esempio n. 16
0
            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);
            }
Esempio n. 17
0
 /// <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)));
 }
Esempio n. 18
0
 /// <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)));
 }
Esempio n. 19
0
 /// <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)));
 }