using NUnit.Framework; namespace Developpez.Dotnet.System.Tests { [TestFixture] public class FileUtilsTests { [Test] public void Test_MakeRelativePath() { string basePath = @"C:\foo"; string path = @"C:\foo\bar"; string expected = "bar"; string actual = FileUtils.MakeRelativePath(path, basePath); Assert.AreEqual(expected, actual); basePath = @"C:\foo\baz"; path = @"C:\foo\bar"; expected = @"..\bar"; actual = FileUtils.MakeRelativePath(path, basePath); Assert.AreEqual(expected, actual); basePath = @"D:\foo\baz"; path = @"C:\foo\bar"; expected = path; actual = FileUtils.MakeRelativePath(path, basePath); Assert.AreEqual(expected, actual); } [Test] public void Test_CombinePaths() { string[] paths = {@"C:\foo", @"bar\baz", "toto", "titi.txt"}; const string expected = @"C:\foo\bar\baz\toto\titi.txt"; string actual = FileUtils.CombinePaths(paths); Assert.AreEqual(expected, actual); } } }