private List <IStep> GetStepsFromDirectory(string sourceDirectory, string destinationDirectory, string backupDirectory) { List <IStep> stepListToInsert = new List <IStep>(); // foreach (string filePath in Directory.GetFiles(sourceDirectory)) { string sourceFileName = Path.GetFileName(filePath); ReplaceFileStep rfs = new ReplaceFileStep(sourceFileName, sourceDirectory, destinationDirectory, backupDirectory); // stepListToInsert.Add(rfs); } foreach (var d in Directory.GetDirectories(sourceDirectory)) { string directoryName = d.Split('\\').LastOrDefault(); CreateDirectoryStep cds = new CreateDirectoryStep(directoryName, destinationDirectory, backupDirectory); destinationDirectory = Path.Combine(destinationDirectory, directoryName); backupDirectory = Path.Combine(backupDirectory, directoryName); stepListToInsert.Add(cds); var tempList = GetStepsFromDirectory(d, destinationDirectory, backupDirectory); stepListToInsert.AddRange(tempList); } // return(stepListToInsert); }
public async Task CreateDirectoryTest() { var app = AvaloniaApp.GetApp(); var window = AvaloniaApp.GetMainWindow(); await FocusFilePanelStep.FocusFilePanelAsync(window); OpenCreateDirectoryDialogStep.OpenCreateDirectoryDialog(window); var isDialogOpened = await DialogOpenedCondition.CheckIfDialogIsOpenedAsync <CreateDirectoryDialog>(app); Assert.True(isDialogOpened); var viewModel = ActiveFilePanelProvider.GetActiveFilePanelViewModel(window); _directoryFullPath = Path.Combine(viewModel.CurrentDirectory, DirectoryName); CreateDirectoryStep.CreateDirectory(app, window, DirectoryName); var isDialogClosed = await DialogClosedCondition.CheckIfDialogIsClosedAsync <CreateDirectoryDialog>(app); Assert.True(isDialogClosed); Assert.True(Directory.Exists(_directoryFullPath)); }
public async Task CreateAndRemoveDirectoryTest() { var app = AvaloniaApp.GetApp(); var window = AvaloniaApp.GetMainWindow(); await FocusFilePanelStep.FocusFilePanelAsync(window); OpenCreateDirectoryDialogStep.OpenCreateDirectoryDialog(window); var isDialogOpened = await DialogOpenedCondition.CheckIfDialogIsOpenedAsync <CreateDirectoryDialog>(app); Assert.True(isDialogOpened); CreateDirectoryStep.CreateDirectory(app, window, DirectoryName); var isDialogClosed = await DialogClosedCondition.CheckIfDialogIsClosedAsync <CreateDirectoryDialog>(app); Assert.True(isDialogClosed); var filesPanel = ActiveFilePanelProvider.GetActiveFilePanelView(window); Assert.NotNull(filesPanel); ToggleSearchPanelStep.ToggleSearchPanelVisibility(window); await Task.Delay(100); var searchPanel = filesPanel .GetVisualDescendants() .OfType <SearchView>() .SingleOrDefault(); Assert.NotNull(searchPanel); var searchTextBox = searchPanel .GetVisualDescendants() .OfType <TextBox>() .SingleOrDefault(); Assert.NotNull(searchTextBox); searchTextBox.SendText(DirectoryName); await Task.Delay(1000); Keyboard.PressKey(window, Key.Tab); Keyboard.PressKey(window, Key.Tab); Keyboard.PressKey(window, Key.Down); Keyboard.PressKey(window, Key.Down); await Task.Delay(100); var selectedItemText = GetSelectedItemText(filesPanel); Assert.Equal(DirectoryName, selectedItemText); OpenRemoveDialogStep.OpenRemoveDialog(window); var isRemoveDialogOpened = await DialogOpenedCondition.CheckIfDialogIsOpenedAsync <RemoveNodesConfirmationDialog>(app); Assert.True(isRemoveDialogOpened); Keyboard.PressKey(window, Key.Enter); await Task.Delay(100); var isRemoveDialogClosed = await DialogClosedCondition.CheckIfDialogIsClosedAsync <RemoveNodesConfirmationDialog>(app); Assert.True(isRemoveDialogClosed); Assert.False(Directory.Exists(_directoryFullPath)); }