private void CopyLogFilesIfChanged() { string originalPath = applicationConfiguration.LogFilePath; if (string.IsNullOrEmpty(originalPath)) { originalPath = ApplicationPaths.AppDataPath(); } if (!originalPath.Equals(workingApplicationConfiguration.LogFilePath, StringComparison.OrdinalIgnoreCase)) { FileCopier.CopyFilesToFolder(originalPath, workingApplicationConfiguration.LogFilePath, "*.json"); } }
public void CopyFilesToFolder_Succeeds() { //arrange string tempPath = Path.GetTempPath(); string destinationPath = Path.Combine(tempPath, Guid.NewGuid().ToString()); if (Directory.Exists(destinationPath)) { Directory.Delete(destinationPath, true); } Directory.CreateDirectory(destinationPath); string sourcePath = Path.GetFullPath("App_Data"); int sourceFileCount = Directory.GetFiles(sourcePath).Length; //act FileCopier.CopyFilesToFolder(sourcePath, destinationPath, "*.*"); int destinationFileCount = Directory.GetFiles(destinationPath).Length; Directory.Delete(destinationPath, true); //assert Assert.AreEqual(sourceFileCount, destinationFileCount); }