Ejemplo n.º 1
0
        public void Directory_Move()
        {
            var tmpSrc = GetNewFileNameOnTempPath("");

            Directory.CreateDirectory(tmpSrc);
            const string fileName = @"temp.txt";

            FileSystem.WriteText(FileSystem.CombinePath(tmpSrc, fileName), "test");

            var tmpDest = GetNewFileNameOnTempPath("");

            FileSystem.MoveDirectory(tmpSrc, tmpDest);
            Assert.IsFalse(FileSystem.DirectoryExists(tmpSrc));
            Assert.IsTrue(FileSystem.DirectoryExists(tmpDest));

            var destFileName = FileSystem.CombinePath(tmpDest, fileName);

            Assert.IsTrue(FileSystem.FileExists(destFileName));
            Assert.AreEqual("test", FileSystem.ReadText(FileSystem.FileFromPath(destFileName)));
        }