Exemple #1
0
        /// <summary>
        /// Handles the Click event of the btnAddTestPlan control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void btnAddTestPlan_Click(object sender, RoutedEventArgs e)
        {
            RegistryManager.WriteTitleTitlePromtDialog(string.Empty);
            var dialog = new PrompDialogWindow();

            dialog.ShowDialog();

            bool   isCanceled;
            string newTitle;
            Task   t = Task.Factory.StartNew(() =>
            {
                isCanceled = RegistryManager.GetIsCanceledPromtDialog();
                newTitle   = RegistryManager.GetContentPromtDialog();
                while (string.IsNullOrEmpty(newTitle) && !isCanceled)
                {
                }
            });

            t.Wait();
            isCanceled = RegistryManager.GetIsCanceledPromtDialog();
            newTitle   = RegistryManager.GetContentPromtDialog();

            if (!isCanceled)
            {
                log.InfoFormat("Add New Test Plan with Name=\"{0}\"", newTitle);
                this.TestPlansEditViewModel.AddTestPlan(newTitle);
            }
        }
        /// <summary>
        /// Handles the Click event of the btnShare control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void btnShare_Click(object sender, RoutedEventArgs e)
        {
            if (this.editViewContext.IsSharedStep)
            {
                return;
            }
            UIRegistryManager.Instance.WriteTitleTitlePromtDialog(string.Empty);
            var dialog = new PrompDialogWindow();
            dialog.ShowDialog();

            bool isCanceled;
            string newTitle;
            Task t = Task.Factory.StartNew(() =>
            {
                isCanceled = UIRegistryManager.Instance.GetIsCanceledPromtDialog();
                newTitle = UIRegistryManager.Instance.GetContentPromtDialog();
                while (string.IsNullOrEmpty(newTitle) && !isCanceled)
                {
                }
            });
            t.Wait();
            isCanceled = UIRegistryManager.Instance.GetIsCanceledPromtDialog();
            newTitle = UIRegistryManager.Instance.GetContentPromtDialog();

            if (!isCanceled)
            {
                List<TestStep> selectedTestSteps = new List<TestStep>();
                this.GetTestStepsFromGrid(selectedTestSteps);
                bool isThereSharedStepSelected = TestStepManager.IsThereSharedStepSelected(selectedTestSteps);
                if (isThereSharedStepSelected)
                {
                    ModernDialog.ShowMessage("Shared steps cannon be shared again!", "Warning", MessageBoxButton.OK);
                    return;
                }
                ISharedStep sharedStepCore = this.TestCaseEditViewModel.TestCase.CreateNewSharedStep(newTitle, selectedTestSteps);
                sharedStepCore.Refresh();
                this.TestCaseEditViewModel.ObservableSharedSteps.Add(new SharedStep(sharedStepCore));
                TestStepManager.UpdateGenericSharedSteps(this.TestCaseEditViewModel.ObservableTestSteps);
            }
        }
        /// <summary>
        /// Handles the Click event of the btnAddTestPlan control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void btnAddTestPlan_Click(object sender, RoutedEventArgs e)
        {
                 RegistryManager.WriteTitleTitlePromtDialog(string.Empty);
            var dialog = new PrompDialogWindow();
            dialog.ShowDialog();

            bool isCanceled;
            string newTitle;
            Task t = Task.Factory.StartNew(() =>
            {
                isCanceled = RegistryManager.GetIsCanceledPromtDialog();
                newTitle = RegistryManager.GetContentPromtDialog();
                while (string.IsNullOrEmpty(newTitle) && !isCanceled)
                {
                }
            });
            t.Wait();
            isCanceled = RegistryManager.GetIsCanceledPromtDialog();
            newTitle = RegistryManager.GetContentPromtDialog();

            if (!isCanceled)
            {
                Log.InfoFormat("Add New Test Plan with Name=\"{0}\"", newTitle);
                this.TestPlansEditViewModel.AddTestPlan(newTitle);
            }
        }
        /// <summary>
        /// Adds the suite internal.
        /// </summary>
        private void AddSuiteInternal()
        {
            RegistryManager.WriteTitleTitlePromtDialog(string.Empty);

            var dialog = new PrompDialogWindow();
            dialog.ShowDialog();
            bool isCanceled;
            string newTitle;
            Task t = Task.Factory.StartNew(() =>
            {
                isCanceled = RegistryManager.GetIsCanceledPromtDialog();
                newTitle = RegistryManager.GetContentPromtDialog();
                while (string.IsNullOrEmpty(newTitle) && !isCanceled)
                {
                }
            });
            t.Wait();
            isCanceled = RegistryManager.GetIsCanceledPromtDialog();
            newTitle = RegistryManager.GetContentPromtDialog();
            if (!isCanceled)
            {
                int selectedSuiteId = RegistryManager.GetSelectedSuiteId();
                bool canBeAddedNewSuite = false;
                int? newSuiteId = TestSuiteManager.AddChildSuite(ExecutionContext.TestManagementTeamProject, ExecutionContext.Preferences.TestPlan, selectedSuiteId, newTitle, out canBeAddedNewSuite);
                if (canBeAddedNewSuite)
                {
                    this.TestCasesInitialViewModel.AddChildSuiteObservableCollection(this.TestCasesInitialViewModel.Suites, selectedSuiteId, (int)newSuiteId);
                }
                else
                {
                    ModernDialog.ShowMessage("Cannot add new suite to Requirments Suite!", "Warrning!", MessageBoxButton.OK);
                }
            }
        }
        /// <summary>
        /// Renames the suite internal.
        /// </summary>
        private void RenameSuiteInternal()
        {
            Suite selectedSuite = tvSuites.SelectedItem as Suite;
            RegistryManager.WriteTitleTitlePromtDialog(selectedSuite.Title);

            var dialog = new PrompDialogWindow();
            dialog.ShowDialog();
            bool isCanceled;
            string newTitle;
            Task t = Task.Factory.StartNew(() =>
            {
                isCanceled = RegistryManager.GetIsCanceledPromtDialog();
                newTitle = RegistryManager.GetContentPromtDialog();
                while (string.IsNullOrEmpty(newTitle) && !isCanceled)
                {
                }
            });
            t.Wait();
            isCanceled = RegistryManager.GetIsCanceledPromtDialog();
            newTitle = RegistryManager.GetContentPromtDialog();
            if (!isCanceled)
            {
                int selectedSuiteId = RegistryManager.GetSelectedSuiteId();
                if (selectedSuiteId == -1)
                {
                    ModernDialog.ShowMessage("Cannot rename root suite!", "Warrning!", MessageBoxButton.OK);
                    return;
                }
				TestSuiteManager.RenameSuite(ExecutionContext.TestManagementTeamProject, ExecutionContext.Preferences.TestPlan, selectedSuiteId, newTitle);
                this.TestCasesInitialViewModel.RenameSuiteInObservableCollection(this.TestCasesInitialViewModel.Suites, selectedSuiteId, newTitle);
            }
        }