Пример #1
0
        private TestResult VerifyProjectInformation(Application application, Log log)
        {
            const string prefix = "Project information";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                // Start new project via File menu
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - The project page was not opened.");

                // Set a name
                var name = "Project-Test-Name";
                ProjectPageControlProxies.ProjectName(application, log, name);

                var storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The written project name does not match the stored project name.");

                // Set a summary
                var summary = "Project-Test-Summary";
                ProjectPageControlProxies.ProjectSummary(application, log, summary);

                var storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.AreEqual(summary, storedSummary, prefix + " - The written project summary does not match the stored project summary.");

                // Set focus away from the text control so that the changes 'stick' by clicking somewhere, in this case the project tab item.
                projectPage.Click();

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);
                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The project name change was undone too early.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was not undone.");

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);

                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedName), prefix + " - The change to the project name was not undone.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was not undone.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The change to the project name was not redone.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was redone too early.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The change to the project name was not redone.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.AreEqual(summary, storedSummary, prefix + " - The change to the project summary was not redone.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }
Пример #2
0
        private TestResult VerifyDatasetCreation(Application application, Log log)
        {
            const string prefix = "Dataset information";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - The project page was not opened.");

                var datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                var datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs before creating sub-datasets.");

                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after creating 1 sub-dataset.");

                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after creating 2 sub-datasets.");

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after undoing the creation of the second dataset.");

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 1);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after undoing the creation of the first dataset.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after redoing the creation of the first dataset.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 3);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after redoing the creation of the second dataset.");

                // Delete first child
                var ids = new List <int>(datasetIds);
                ids.Sort();
                ProjectPageControlProxies.DeleteDataset(application, log, ids[1]);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after the deletion of the first dataset.");
                assert.IsTrue(datasetIds.Contains(ids[2]), prefix + " - The second dataset was deleted but should not have been.");

                // Delete second child
                ProjectPageControlProxies.DeleteDataset(application, log, ids[2]);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 1);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after the deletion of the second dataset.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }