Esempio n. 1
0
        public void MoveFileExceptions()
        {
            string file1 = Path.GetTempFileName();
            string file2 = Path.GetTempFileName();

            Assert.Throws <IOException>(() => OsUtils.MoveFile(file1, file2));

            if (OsUtils.Windows())
            {
                // Pretty much everything is valid in a path under Linux, so only test on Windows
                Assert.Throws <IOException>(() => OsUtils.MoveFile(file1, file2 + ":"));
            }

            Assert.Throws <DirectoryNotFoundException>(
                () => OsUtils.MoveFile(file1, Path.Combine(Path.GetTempPath(), Path.GetRandomFileName(), "filename")));
        }