public void GetFullPath() { Debug.WriteLine("TEST START: GetFullPath"); var io = new WindowsFileSystemCacheKeyStorage("C:\\root"); // You're supposed to provide a base path in a constructor and a relative path when doing IO operations Assert.AreEqual("C:/root/subroot/file.bin", io.GetFullPath("subroot\\file.bin")); Assert.AreEqual("C:/root/subroot/../subroot/file.bin", io.GetFullPath("subroot\\..\\subroot\\file.bin")); // It's okay if the relative path is empty, which means you're referring to folder specified by the base bath Assert.AreEqual("C:/root", io.GetFullPath(string.Empty)); // Do not pass an absolute path as a relative path Assert.ThrowsException <ArgumentException>(() => io.GetFullPath("C:\\root\\subroot\\file.bin")); // Base path may not be empty or in a relative format Assert.ThrowsException <ArgumentException>(() => new WindowsFileSystemCacheKeyStorage(string.Empty)); Assert.ThrowsException <ArgumentException>(() => new WindowsFileSystemCacheKeyStorage("subroot\\file.bin")); }
public void TestInitialize() { TestCleanup(); _io = new WindowsFileSystemCacheKeyStorage(Path.Combine(AssemblyUtilsEx.GetExecutingAssemblyDirectory(), TestFolder)); _data = RandomDataUtils.GetRandomData(1024); }