示例#1
0
        public void TestIsDirectoryOnly()
        {
            var dirPath = new UDirectory("/a/b/c");

            Assert.AreEqual("/a/b/c", dirPath.GetDirectory());

            var filePath = new UFile("/test.txt");

            Assert.AreEqual("/", filePath.GetDirectory());
            Assert.AreEqual("test.txt", filePath.GetFileNameWithExtension());
        }
示例#2
0
文件: TestUPath.cs 项目: neviim/xenko
        public void TestIsDirectoryOnly()
        {
            Assert.False(new UFile("/a/b/c.txt").IsDirectoryOnly);

            var dirPath = new UDirectory("/a/b/c");

            Assert.True(dirPath.IsDirectoryOnly);
            Assert.AreEqual("/a/b/c", dirPath.GetDirectory());

            Assert.True(new UDirectory("").IsDirectoryOnly);
            Assert.True(new UDirectory("C:/").IsDirectoryOnly);
            Assert.False(new UFile("C:/a.txt").IsDirectoryOnly);

            var filePath = new UFile("/test.txt");

            Assert.AreEqual("/", filePath.GetDirectory());
            Assert.AreEqual("test.txt", filePath.GetFileNameWithExtension());
        }
示例#3
0
        public void TestIsDirectoryOnly()
        {
            Assert.False(new UFile("/a/b/c.txt").IsDirectoryOnly);

            var dirPath = new UDirectory("/a/b/c");
            Assert.True(dirPath.IsDirectoryOnly);
            Assert.AreEqual("/a/b/c", dirPath.GetDirectory());

            var filePath = new UFile("/test.txt");
            Assert.AreEqual("/", filePath.GetDirectory());
            Assert.AreEqual("test.txt", filePath.GetFileNameWithExtension());
        }