Example #1
0
        private void ExecuteFlowApiTestCase(FlowApiTestCase testItem, string quoteId = null)
        {
            ParameterValidator.ValidateNotNull(testItem, "Test Item");

            AssignTestName(testItem);

            var breezeApi = new BreezeApi(EnvironmentSetting, quoteId);

            foreach (var stepItem in testItem.TestCaseSteps)
            {
                // Given
                var    parameters = stepItem.Parameters.ToJObject();
                string screenName = parameters.Item("screenName");
                var    header     = parameters.Item("header");
                // Generate dynamic data for budy
                var body = breezeApi.ConvertDynamicData(stepItem.Body);

                // When
                IRestResponse result = breezeApi.ExecuteBreezeAPI(screenName, body, header);

                // Then
                result.StatusCode.Should().Be(stepItem.ExpectedStatusCode);
                // Update dynamic Id from response content
                breezeApi.UpdateDynamicIdData(screenName, result.Content);
                // Generate dynamic data for expected result
                var expectedResult = breezeApi.ConvertDynamicData(stepItem.ExpectedResult);

                var expectedResponse = breezeApi.GetExpectedResponseObject(expectedResult);
                var actualResponse   = breezeApi.GetActualResponseObject(result.Content);

                actualResponse.ShouldBeEquivalentTo(expectedResponse);
            }
        }
Example #2
0
        private void ExportWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            _exportWorker.ReportProgress(0, "");

            var exportSettings = ( ExportSettings )e.Argument;

            // clear filesystem directories
            BreezeApi.InitializeExport();

            // export individuals, phone numbers, and addresses
            _exportWorker.ReportProgress(1, "Exporting Individuals...");
            BreezeApi.ExportPeople(exportSettings.PersonCsvFileName, _exportWorker);

            if (BreezeApi.ErrorMessage.IsNotNullOrWhitespace())
            {
                ShowError($"Error exporting individuals: {BreezeApi.ErrorMessage}");
                return;
            }

            // export notes
            _exportWorker.ReportProgress(1, "Exporting Notes...");
            BreezeApi.ExportNotes(exportSettings.NotesCsvFileName, _exportWorker);

            if (BreezeApi.ErrorMessage.IsNotNullOrWhitespace())
            {
                ShowError($"Error exporting notes: {BreezeApi.ErrorMessage}");
                return;
            }

            // export gifts
            _exportWorker.ReportProgress(1, "Exporting Gifts...");
            BreezeApi.ExportGiving(exportSettings.GivingCsvFileName, _exportWorker);

            if (BreezeApi.ErrorMessage.IsNotNullOrWhitespace())
            {
                ShowError($"Error exporting gifts: {BreezeApi.ErrorMessage}");
                return;
            }

            // export tags
            _exportWorker.ReportProgress(1, "Exporting Tags...");
            BreezeApi.ExportTags(exportSettings.TagsXlsxFileName, _exportWorker);

            if (BreezeApi.ErrorMessage.IsNotNullOrWhitespace())
            {
                ShowError($"Error exporting tags: {BreezeApi.ErrorMessage}");
                return;
            }

            // finalize the package
            if (!hasErrors)
            {
                ImportPackage.FinalizePackage("breeze-export.slingshot");
            }

            // schedule the API status to update (the status takes a few mins to update)
            _apiUpdateTimer.Start();
        }