Пример #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
        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());
        }