private void MoveQueryButton_Click(object sender, RoutedEventArgs e) { try { //Search for folders QueryFolder myOldFolder = tfsHelperFunctions.Search(MoveQueryOldFolderTextBox.Text); QueryFolder myNewFolder = tfsHelperFunctions.Search(MoveQueryNewFolderTextBox.Text); //// Test query if needed //tfsHelperFunctions.AddNewQuery("Test Query", // "SELECT [System.Title], [System.State] FROM WorkItems WHERE [System.AssignedTo] = @me " + // "AND [System.WorkItemType] = 'Task'", myOldFolder); //Copy queries from previous folder tfsHelperFunctions.CopyPreviousQueryFolderContent(myOldFolder, myNewFolder); //success message this.ShowMessageAsync("Success", "Queries moved from " + MoveQueryOldFolderTextBox.Text + " to " + MoveQueryNewFolderTextBox.Text + "!"); } catch (Exception ex) { if (ex is InvalidOperationException) { this.ShowMessageAsync("Error", "Cannot add queries that already exist"); } else if (ex is NullReferenceException) { this.ShowMessageAsync("Error", "Please connect to a TFS project" + " and verify the folders exist before copying queries between them"); } } }
public void CopyTest() { // arrange QueryFolder testFolderOne = new QueryFolder("TestFolderOne"); QueryFolder testFolderTwo = new QueryFolder("TestFolderTwo"); string queryTitle = "TestTitle"; string queryCommand = "SELECT [System.Title], [System.State] FROM WorkItems WHERE [System.AssignedTo] = @me"; // act tfsHelperFunctions.AddNewQuery(queryTitle, queryCommand, testFolderOne); tfsHelperFunctions.CopyPreviousQueryFolderContent(testFolderOne, testFolderTwo); // assert }