Example #1
0
        public void SimpleWrappers()
        {
            Assert.AreEqual(Path.Combine("test"), FileSystem.CombinePath("test"));
            Assert.AreEqual(Path.Combine("test", "1"), FileSystem.CombinePath("test", "1"));
            Assert.AreEqual(Path.Combine("test/", @"1\"), FileSystem.CombinePath("test/", @"1\"));

            const string aFilePath = @"hello\there.txt";
            const string aFileName = "hello";

            Assert.AreEqual(Path.GetExtension(aFilePath), FileSystem.FileExtension(aFilePath));
            Assert.AreEqual(Path.GetExtension(aFileName), FileSystem.FileExtension(aFileName));

            Assert.AreEqual(
                Path.ChangeExtension(aFilePath, ".png"),
                FileSystem.ChangePathExtension(aFilePath, ".png"));
            Assert.AreEqual(
                Path.ChangeExtension(aFileName, ".txt"),
                FileSystem.ChangePathExtension(aFileName, ".txt"));

            Assert.AreEqual(Path.GetDirectoryName(aFilePath), FileSystem.DirectoryName(aFilePath));
            Assert.AreEqual(Path.GetDirectoryName(aFileName), FileSystem.DirectoryName(aFileName));

            Assert.AreEqual(Path.HasExtension(aFilePath), FileSystem.FileHasExtension(aFilePath));
            Assert.AreEqual(Path.HasExtension(aFileName), FileSystem.FileHasExtension(aFileName));
        }