Ejemplo n.º 1
0
        public void Archive_File()
        {
            var folder           = "C:\\Test";
            var file             = "TestArchive.xlsx";
            var archiveDirectory = $"{folder}\\ArchiveTest";

            Directory.CreateDirectory(folder);
            var fileStream = File.Create($"{folder}\\{file}");

            fileStream.Close();
            if (Directory.Exists(archiveDirectory))
            {
                Directory.GetFiles(archiveDirectory, "TestArchive*.xlsx", SearchOption.TopDirectoryOnly).ToList().ForEach(f => File.Delete(f));
            }

            FileUtilities.ArchiveFile($"{folder}\\{file}", archiveDirectory);

            var files = Directory.GetFiles(archiveDirectory, "TestArchive_*.xlsx", SearchOption.TopDirectoryOnly);

            Assert.AreEqual(1, files.Count());
        }