Ejemplo n.º 1
0
            public void ShouldNotRemoveOnlyRelativePart(string value)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                path.FullPath.ShouldBe("/");
            }
Ejemplo n.º 2
0
            public void ShouldRemoveTrailingSlashes(string value, string expected)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                Assert.AreEqual(expected, path.FullPath);
            }
Ejemplo n.º 3
0
            public void WillTrimWhiteSpaceFromPath()
            {
                // Given, When
                TestPath path = new TestPath(" shaders/basic ");

                // Then
                Assert.AreEqual("shaders/basic", path.FullPath);
            }
Ejemplo n.º 4
0
            public void ShouldNotPrependSlashForRootedPath()
            {
                // Given, When
                TestPath path = new TestPath("C:/shaders/basic");

                // Then
                path.FullPath.ShouldBe("C:\\shaders/basic");
            }
Ejemplo n.º 5
0
            public void WillNotRemoveWhiteSpaceWithinPath()
            {
                // Given, When
                TestPath path = new TestPath("my awesome shaders/basic");

                // Then
                Assert.AreEqual("my awesome shaders/basic", path.FullPath);
            }
Ejemplo n.º 6
0
            public void CurrentDirectoryReturnsEmptyPath()
            {
                // Given, When
                TestPath path = new TestPath("./");

                // Then
                Assert.AreEqual(string.Empty, path.FullPath);
            }
Ejemplo n.º 7
0
            public void WillNormalizePathSeparators()
            {
                // Given, When
                TestPath path = new TestPath("shaders\\basic");

                // Then
                Assert.AreEqual("shaders/basic", path.FullPath);
            }
Ejemplo n.º 8
0
            public void ShouldReturnWhetherOrNotAPathIsRelativeOnWindows(string fullPath, bool expected)
            {
                // Given, When
                var path = new TestPath(fullPath);

                // Then
                Assert.AreEqual(expected, path.IsRelative);
            }
Ejemplo n.º 9
0
            public void Should_Return_The_Full_Path()
            {
                // Given, When
                var path = new TestPath("temp/hello");

                // Then
                Assert.AreEqual("temp/hello", path.ToString());
            }
Ejemplo n.º 10
0
            public void ShouldReturnProvider(string provider, string pathName, string expectedProvider)
            {
                // Given, W
                TestPath path = new TestPath(provider, pathName);

                // Then
                Assert.AreEqual(expectedProvider, path.Provider);
            }
Ejemplo n.º 11
0
            public void ShouldTrimWhiteSpaceFromPathAndLeaveSpaces()
            {
                // Given, When
                TestPath path = new TestPath("\t\r\nshaders/basic ");

                // Then
                Assert.AreEqual("shaders/basic ", path.FullPath);
            }
Ejemplo n.º 12
0
        public void TestParse2()
        {
            var path = TestPath.Get(@"Parser/MissingTargetsAttribute.csproj");

            new Action(() => _parser.Parse(path))
            .ShouldThrow <ParseException>()
            .WithMessage("error  : The required attribute \"Name\" is empty or missing from the element <Target>.");
        }
Ejemplo n.º 13
0
            public void ShouldRemoveTrailingSlashes(string value, string expected)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                path.FullPath.ShouldBe(expected);
            }
Ejemplo n.º 14
0
            public void ShouldNotRemoveWhiteSpaceWithinPath()
            {
                // Given, When
                TestPath path = new TestPath("my awesome shaders/basic");

                // Then
                path.FullPath.ShouldBe("my awesome shaders/basic");
            }
Ejemplo n.º 15
0
            public void ShouldReturnStringRepresentation(string path, string expected)
            {
                // Given, When
                TestPath testPath = new TestPath(path);

                // Then
                testPath.ToString().ShouldBe(expected);
            }
Ejemplo n.º 16
0
            public void ShouldNormalizePathSeparators()
            {
                // Given, When
                TestPath path = new TestPath("shaders\\basic");

                // Then
                path.FullPath.ShouldBe("shaders/basic");
            }
Ejemplo n.º 17
0
            public void ShouldNotRemoveSingleTrailingSlash(string value)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                Assert.AreEqual("/", path.FullPath);
            }
Ejemplo n.º 18
0
            public void ShouldTrimWhiteSpaceFromPathAndLeaveSpaces()
            {
                // Given, When
                TestPath path = new TestPath("\t\r\nshaders/basic ");

                // Then
                path.FullPath.ShouldBe("shaders/basic ");
            }
Ejemplo n.º 19
0
            public void ShouldNotRemoveOnlyRelativePart(string value)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                Assert.AreEqual("/", path.FullPath);
            }
Ejemplo n.º 20
0
            public void ShouldRemoveRelativePrefix(string value, string expected)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                Assert.AreEqual(expected, path.FullPath);
            }
Ejemplo n.º 21
0
            public void ShouldSetProviderIfGivenOnlyScheme()
            {
                // Given, When
                TestPath path = new TestPath("foo", "/a/b");

                // Then
                Assert.AreEqual(new Uri("foo:"), path.FileProvider);
            }
Ejemplo n.º 22
0
            public void ExplicitNullProviderShouldStayNull()
            {
                // Given, When
                TestPath testPath = new TestPath((Uri)null, "/a/b/c", PathKind.Absolute);

                // Then
                Assert.IsNull(testPath.FileProvider);
            }
Ejemplo n.º 23
0
            public void UnspecifiedProviderShouldUseDefault()
            {
                // Given, When
                TestPath testPath = new TestPath("/a/b/c", PathKind.Absolute);

                // Then
                Assert.AreEqual(new Uri("file:///"), testPath.FileProvider);
            }
Ejemplo n.º 24
0
            public void ShouldRemoveRelativePrefix(string value, string expected)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                path.FullPath.ShouldBe(expected);
            }
Ejemplo n.º 25
0
            public void ShouldNotRemoveSingleTrailingSlash(string value)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                path.FullPath.ShouldBe("/");
            }
Ejemplo n.º 26
0
            public void CurrentDirectoryReturnsDot()
            {
                // Given, When
                TestPath path = new TestPath("./");

                // Then
                Assert.AreEqual(".", path.FullPath);
            }
Ejemplo n.º 27
0
            public void CurrentDirectoryReturnsDot()
            {
                // Given, When
                TestPath path = new TestPath("./");

                // Then
                Assert.AreEqual(".", path.FullPath);
            }
Ejemplo n.º 28
0
            public void ShouldReturnWhetherOrNotAPathIsRelativeOnWindows(string fullPath, bool expected)
            {
                // Given, When
                TestPath path = new TestPath(fullPath);

                // Then
                path.IsRelative.ShouldBe(expected);
            }
Ejemplo n.º 29
0
            public void ShouldNormalizePathSeparators()
            {
                // Given, When
                TestPath path = new TestPath("shaders\\basic");

                // Then
                Assert.AreEqual("shaders/basic", path.FullPath);
            }
Ejemplo n.º 30
0
            public void CurrentDirectoryReturnsDot()
            {
                // Given, When
                TestPath path = new TestPath("./");

                // Then
                path.FullPath.ShouldBe(".");
            }
Ejemplo n.º 31
0
            public void ShouldReturnStringRepresentation(string provider, string path, string expected)
            {
                // Given, When
                TestPath testPath = new TestPath(provider == null ? null : new Uri(provider), path);

                // Then
                Assert.AreEqual(expected, testPath.ToString());
            }
Ejemplo n.º 32
0
            public void ShouldReturnFullPath()
            {
                // Given, When
                const string expected = "shaders/basic";
                TestPath     path     = new TestPath(expected);

                // Then
                Assert.AreEqual(expected, path.FullPath);
            }
Ejemplo n.º 33
0
            public void ShouldReturnProvider(string provider, string pathName, string expectedProvider)
            {
                // Given, W
                TestPath path = new TestPath(provider, pathName);

                // Then
                Assert.AreEqual(expectedProvider == null ? null : new Uri(expectedProvider), path.FileProvider);
            }
Ejemplo n.º 34
0
            public void UnspecifiedProviderShouldUseDefault()
            {
                // Given, When
                TestPath testPath = new TestPath("/a/b/c", PathKind.Absolute);

                // Then
                Assert.AreEqual(new Uri("file:///"), testPath.FileProvider);
            }
Ejemplo n.º 35
0
            public void ShouldReturnFullPath()
            {
                // Given, When
                const string expected = "shaders/basic";
                TestPath path = new TestPath(expected);

                // Then
                Assert.AreEqual(expected, path.FullPath);
            }
Ejemplo n.º 36
0
            public void ShouldReturnSegmentsOfPath(string pathName)
            {
                // Given, When
                TestPath path = new TestPath(pathName);

                // Then
                Assert.AreEqual(2, path.Segments.Length);
                Assert.AreEqual("Hello", path.Segments[0]);
                Assert.AreEqual("World", path.Segments[1]);
            }
Ejemplo n.º 37
0
            public void ShouldReturnDottedRootForExplicitRelativePath(string fullPath)
            {
                // Given
                TestPath path = new TestPath(fullPath, PathKind.Relative);

                // When
                DirectoryPath root = path.Root;

                // Then
                Assert.AreEqual(".", root.FullPath);
            }
Ejemplo n.º 38
0
            public void ShouldReturnRootPath(string fullPath, string expected)
            {
                // Given
                TestPath path = new TestPath(fullPath);

                // When
                DirectoryPath root = path.Root;

                // Then
                Assert.AreEqual(expected, root.FullPath);
            }
Ejemplo n.º 39
0
            public void ShouldReturnWhetherOrNotAPathIsRelativeOnWindows(string fullPath, bool expected)
            {
                // Given, When
                TestPath path = new TestPath(fullPath);

                // Then
                Assert.AreEqual(expected, path.IsRelative);
            }
Ejemplo n.º 40
0
            public void ShouldReturnStringRepresentation(string provider, string path, string expected)
            {
                // Given, When
                TestPath testPath = new TestPath(provider == null ? null : new Uri(provider), path);

                // Then
                Assert.AreEqual(expected, testPath.ToString());
            }
Ejemplo n.º 41
0
            public void ShouldTrimWhiteSpaceFromPath()
            {
                // Given, When
                TestPath path = new TestPath(" shaders/basic ");

                // Then
                Assert.AreEqual("shaders/basic", path.FullPath);
            }
Ejemplo n.º 42
0
            public void ShouldNotRemoveWhiteSpaceWithinPath()
            {
                // Given, When
                TestPath path = new TestPath("my awesome shaders/basic");

                // Then
                Assert.AreEqual("my awesome shaders/basic", path.FullPath);
            }
Ejemplo n.º 43
0
            public void ShouldUsePathAsFullPathIfNoPathInString()
            {
                // Given, When
                TestPath testPath = new TestPath("foo:");

                // Then
                Assert.AreEqual(null, testPath.FileProvider);
                Assert.AreEqual("foo:/", testPath.FullPath); // The slash is appended w/ assumption this is a file path
            }
Ejemplo n.º 44
0
            public void ShouldSetUriAsRelativePathIfNoLeftPart(string path)
            {
                // Given, When
                TestPath testPath = new TestPath(new Uri(path, UriKind.Relative));

                // Then
                Assert.AreEqual(null, testPath.FileProvider);
                Assert.AreEqual(path, testPath.FullPath);
                Assert.IsTrue(testPath.IsRelative);
            }
Ejemplo n.º 45
0
            public void ShouldSetRootPathIfOnlyRootInUri(string path)
            {
                // Given, When
                TestPath testPath = new TestPath(new Uri(path));

                // Then
                Assert.AreEqual(new Uri(path), testPath.FileProvider);
                Assert.AreEqual("/", testPath.FullPath);
            }
Ejemplo n.º 46
0
            public void ShouldSetNullProviderForFirstCharDelimiter()
            {
                // Given, When
                TestPath path = new TestPath("|foo://a/b/c");

                // Then
                Assert.AreEqual(null, path.FileProvider);
                Assert.AreEqual("foo://a/b/c", path.FullPath);
            }
Ejemplo n.º 47
0
            public void ExplicitNullProviderShouldStayNull()
            {
                // Given, When
                TestPath testPath = new TestPath((Uri)null, "/a/b/c", PathKind.Absolute);

                // Then
                Assert.IsNull(testPath.FileProvider);
            }
Ejemplo n.º 48
0
            public void ShouldNotRemoveOnlyRelativePart(string value)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                Assert.AreEqual("/", path.FullPath);
            }
Ejemplo n.º 49
0
            public void ShouldSplitUriPathWithDelimiter()
            {
                // Given, When
                TestPath path = new TestPath(new Uri("foo:///a/b|c/d/e"));

                // Then
                Assert.AreEqual(new Uri("foo:///a/b"), path.FileProvider);
                Assert.AreEqual("c/d/e", path.FullPath);
                Assert.IsTrue(path.IsAbsolute);
            }
Ejemplo n.º 50
0
            public void ShouldNotRemoveSingleTrailingSlash(string value)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                Assert.AreEqual("/", path.FullPath);
            }
Ejemplo n.º 51
0
            public void ShouldSetProviderIfGivenOnlyScheme()
            {
                // Given, When
                TestPath path = new TestPath("foo", "/a/b");

                // Then
                Assert.AreEqual(new Uri("foo:"), path.FileProvider);
            }
Ejemplo n.º 52
0
            public void ShouldRemoveTrailingSlashes(string value, string expected)
            {
                // Given, When
                TestPath path = new TestPath((Uri)null, value);

                // Then
                Assert.AreEqual(expected, path.FullPath);
            }
Ejemplo n.º 53
0
            public void ShouldRemoveRelativePrefix(string value, string expected)
            {
                // Given, When
                TestPath path = new TestPath(value);

                // Then
                Assert.AreEqual(expected, path.FullPath);
            }