Beispiel #1
0
        private void CopyFile()
        {
            FileSystemAwareFileUtilities fileUtils = new FileSystemAwareFileUtilities(new DeviceManager(), new StreamHelper(), new FileSystemAwareFileInfoProvider(new DeviceManager()));

            if (!fileUtils.FileExists(GetSourcePath()))
            {
                DisplayMessage(string.Format("Cannot find source file {0}", GetSourcePath()), DisplayLevel.Error);
            }

            if (fileUtils.FileExists(GetDestinationPath()))
            {
                fileUtils.FileDelete(GetDestinationPath());
            }

            // put this section in the test preable
            string folder = GetRootFolder();
            FileSystemAwareDirectoryInfoProvider dirInfoProvider = new FileSystemAwareDirectoryInfoProvider(new DeviceManager());
            IDirectoryInfo info = dirInfoProvider.GetDirectoryInfo(folder);

            info.Create();

            fileUtils.FileCopy(GetSourcePath(), GetDestinationPath());

            if (fileUtils.FileExists(GetDestinationPath()))
            {
                DisplayMessage(string.Format("File copied to {0} OK", GetDestinationPath()));
            }
            else
            {
                DisplayMessage(string.Format("Cannot find destination file {0}", GetDestinationPath()), DisplayLevel.Error);
            }
        }
Beispiel #2
0
        private void ScrubOutAllTestData()
        {
            // note you may want to comment this out to see what the hell is going on

            // get rid of any file that we created
            FileSystemAwareFileUtilities fileUtils = new FileSystemAwareFileUtilities(new DeviceManager(), new StreamHelper(), new FileSystemAwareFileInfoProvider(new DeviceManager()));

            if (fileUtils.FileExists(GetDestinationPath()))
            {
                fileUtils.FileDelete(GetDestinationPath());
            }

            // get rid of any folders we created
            FileSystemAwareDirectoryInfoProvider dirInfoProvider = new FileSystemAwareDirectoryInfoProvider(new DeviceManager());
            IDirectoryInfo info = dirInfoProvider.GetDirectoryInfo(GetRootFolder());

            info.Delete();
        }