Example #1
0
        public void TestCombineN(string[] parts, string expectedResult)
        {
            var path = UPath.Combine(parts.Select(a => (UPath)a).ToArray());

            Assert.Equal(expectedResult, (string)path);

            // Compare path info directly
            var expectedPath = new UPath(expectedResult);

            Assert.Equal(expectedPath, path);
            Assert.Equal(expectedPath.GetHashCode(), path.GetHashCode());
        }
Example #2
0
        public void TestCombine4(string path1, string path2, string path3, string path4, string expectedResult)
        {
            var path = UPath.Combine(path1, path2, path3, path4);

            Assert.Equal(expectedResult, (string)path);

            // Compare path info directly
            var expectedPath = new UPath(expectedResult);

            Assert.Equal(expectedPath, path);
            Assert.Equal(expectedPath.GetHashCode(), path.GetHashCode());
        }
Example #3
0
        public void TestNormalize(string pathAsText, string expectedResult)
        {
            var path = new UPath(pathAsText);

            Assert.Equal(expectedResult, path.FullName);

            // Check Equatable
            var expectedPath = new UPath(expectedResult);

            Assert.Equal(expectedPath, path);
            Assert.True(expectedPath.Equals((object)path));
            Assert.Equal(expectedPath.GetHashCode(), path.GetHashCode());
            Assert.True(path == expectedPath);
            Assert.False(path != expectedPath);

            // Check TryParse
            UPath result;

            Assert.True(UPath.TryParse(path.FullName, out result));
        }