public async Task Get_Tasks_v1_initial_configuration_check()
        {
            var responseDTO = await CompleteInitialConfiguration();

            var crateStorage = Crate.FromDto(responseDTO.CrateStorage);

            AssertInitialConfigurationResponse(responseDTO);

            var fieldsToPayload = crateStorage.CratesOfType <CrateDescriptionCM>().ToList();

            // there should be one field of MT.AsanaTaskList and one feild of MT.StandardTableData
            Assert.AreEqual(1, fieldsToPayload.Count);

            var asanaTaskMTId             = (int)MT.AsanaTaskList;
            var AsanaTaskListPayloadCount = fieldsToPayload
                                            .FirstOrDefault()
                                            .Content
                                            .CrateDescriptions
                                            .Count(x => x.ManifestId == asanaTaskMTId);

            Assert.AreEqual(AsanaTaskListPayloadCount, 1);

            var tableDataMTId         = (int)MT.StandardTableData;
            var TableDataPayloadCount = fieldsToPayload
                                        .FirstOrDefault()
                                        .Content
                                        .CrateDescriptions
                                        .Count(x => x.ManifestId == asanaTaskMTId);

            Assert.AreEqual(TableDataPayloadCount, 1);
        }
        public async Task Run_Returns_ActivityDTO()
        {
            //Arrange
            var        runUrl  = GetTerminalRunUrl();
            Fr8DataDTO dataDto = HealthMonitor_FixtureData.GetFileListTestFr8DataDTO();

            // Add initial configuretion controls
            using (var crateStorage = Crate.GetUpdatableStorage(dataDto.ActivityDTO))
            {
                crateStorage.Add("Configuration_Controls", new StandardConfigurationControlsCM());
            }
            // Add operational state crate
            AddOperationalStateCrate(dataDto, new OperationalStateCM());

            //Act
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(
                    runUrl,
                    dataDto
                    );

            //Assert
            Assert.IsNotNull(responseActionDTO);
            var crateFromDTO = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.IsNotNull(crateFromDTO);
            Assert.Greater(crateFromDTO.CratesOfType <StandardFileListCM>().Count(), 0);
        }
예제 #3
0
        public async Task Create_Stat_FollowUp_Configuration_Check_Crate_Structure()
        {
            var configureUrl = GetTerminalConfigureUrl();
            var responseDTO  = await CompleteInitialConfiguration();

            responseDTO.AuthToken = await _authorizationTokenHelper.GetStatXAuthToken();

            var dataDTO = new Fr8DataDTO
            {
                ActivityDTO = responseDTO
            };

            responseDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO);

            Assert.NotNull(responseDTO, "Response is null on initial configuration");
            Assert.NotNull(responseDTO.CrateStorage, "Crate storage is null on initial configuration");
            var crateStorage = Crate.FromDto(responseDTO.CrateStorage);

            Assert.AreEqual(2, crateStorage.Count, "Crate storage count is not equal to 1");
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count(), "StandardConfigurationControlsCM count is not 1");

            Assert.AreEqual(2, crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single().Controls.Count, "Control count is not 2");
            Assert.IsTrue(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single().Controls[0] is RadioButtonGroup, "First control isn't a RadioButtonGroup");
            Assert.AreEqual("StatXGroupsSelectionGroup", crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single().Controls[0].Name, "Invalid Name on control");
        }
예제 #4
0
        public async Task SendEmailViaSendGrid_Initial_Configuration_Check_Crate_Structure()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();

            var requestActionDTO = HealthMonitor_FixtureData.SendEmailViaSendGrid_v1_InitialConfiguration_Fr8DataDTO();

            //Act
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    requestActionDTO
                    );

            //Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            activityDTOInit = responseActionDTO;
            Assert.IsNotNull(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().SingleOrDefault());
            // There is no FieldDescriptionsCM in the create storage;
            // TODO: UPDATE TEST
            // Assert.AreEqual(1, crateStorage.CrateContentsOfType<FieldDescriptionsCM>().Count());

            var standardConfigurationControlCM = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>();

            Assert.AreEqual(1, standardConfigurationControlCM.Where(w => w.FindByName("EmailAddress") != null).Count());
            Assert.AreEqual(1, standardConfigurationControlCM.Where(w => w.FindByName("EmailSubject") != null).Count());
            Assert.AreEqual(1, standardConfigurationControlCM.Where(w => w.FindByName("EmailBody") != null).Count());
        }
        public async Task ConnectToSql_FollowUp_Configuration_Wrong_ConnetcioString_Check_Crate_Structure()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var dataDTO = FixtureData.ConnectToSql_InitialConfiguration_Fr8DataDTO();

            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            using (var updatableStorage = Crate.GetUpdatableStorage(responseActionDTO))
            {
                updatableStorage.RemoveByLabel("Configuration_Controls");
                updatableStorage.Add(CreateWrongConnectionStringCrate());
            }
            dataDTO.ActivityDTO = responseActionDTO;
            responseActionDTO   =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());
            AssertErrorControls(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single());
        }
예제 #6
0
        public async Task Get_Google_Sheet_Data_v1_FollowupConfiguration_Row_And_Column_Table()
        {
            var configureUrl = GetTerminalConfigureUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestActionDTO = fixture.Get_Google_Sheet_Data_v1_Followup_Configuration_Request_ActivityDTO_With_Crates();

            ////Act
            fixture.Get_Google_Sheet_Data_v1_AddPayload(requestActionDTO, "Row_And_Column");
            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };
            //As the ActionDTO is preconfigured configure url actually calls the follow up configuration
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            //Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());

            // Due to performance issue, remove functionalilty to load table contents
            //  Assert.AreEqual("(2,1)", crateStorage.CratesOfType<StandardTableDataCM>().Single().Content.Table[0].Row[0].Cell.Value);
            //Assert.AreEqual("(2,2)", crateStorage.CratesOfType<StandardTableDataCM>().Single().Content.Table[0].Row[1].Cell.Value);
        }
예제 #7
0
        public async Task Get_Jira_Issue_v1_Run_CheckPayloadDTO()
        {
            var activityDTO = await ConfigureFollowUp();

            activityDTO.AuthToken = HealthMonitor_FixtureData.Jira_AuthToken();

            var runUrl = GetTerminalRunUrl();
            var data   = new Fr8DataDTO()
            {
                ActivityDTO = activityDTO
            };

            AddPayloadCrate(data, new OperationalStateCM());

            var payload = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, data);

            Assert.IsNotNull(payload);
            Assert.IsNotNull(payload.CrateStorage);

            var crateStorage = Crate.FromDto(payload.CrateStorage);

            Assert.AreEqual(2, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <OperationalStateCM>().Count());
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardPayloadDataCM>().Count());

            var payloadData = crateStorage.CrateContentsOfType <StandardPayloadDataCM>().First();

            Assert.IsNotNull(payloadData.PayloadObjects);
            Assert.AreEqual(1, payloadData.PayloadObjects.Count);
            Assert.AreEqual("FR-1245", payloadData.PayloadObjects[0].GetValue("Key"));
        }
예제 #8
0
        public async Task Write_To_Log_FollowUp_Configuration_Check_Crate_Structure()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();

            var requestActionDTO = HealthMonitor_FixtureData.Write_To_Log_v1_InitialConfiguration_Fr8DataDTO();

            //Act
            //Call first time for the initial configuration
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    requestActionDTO
                    );

            //Call second time for the follow up configuration
            responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    requestActionDTO
                    );

            //Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            AssertCrateTypes(crateStorage);
            AssertControls(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single());
        }
예제 #9
0
        public async Task Get_Google_Sheet_Data_v1_FollowupConfiguration_Row_Only_Table()
        {
            var configureUrl = GetTerminalConfigureUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestActionDTO = fixture.Get_Google_Sheet_Data_v1_Followup_Configuration_Request_ActivityDTO_With_Crates();

            ////Act
            fixture.Get_Google_Sheet_Data_v1_AddPayload(requestActionDTO, "Row_Only");
            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };
            //As the ActionDTO is preconfigured configure url actually calls the follow up configuration
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            //Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());
        }
예제 #10
0
        public void Check_Initial_Configuration_Crate_Structure()
        {
            //Assert.AreEqual(1, 2);
            var configureUrl = GetTerminalConfigureUrl();

            var requestActionDTO = CreateRequestActivityFixture();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };
            var responseActionDTO = HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO).Result;

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(2, crateStorage.Count);

            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count(x => x.Label == "Configuration_Controls"));
            Assert.AreEqual(1, crateStorage.CratesOfType <KeyValueListCM>().Count(x => x.Label == "Select Fr8 Object"));

            var configCrate = crateStorage
                              .CrateContentsOfType <StandardConfigurationControlsCM>(x => x.Label == "Configuration_Controls")
                              .SingleOrDefault();

            ValidateConfigurationCrateStructure(configCrate);

            var designTimeCrate = crateStorage
                                  .CrateContentsOfType <KeyValueListCM>(x => x.Label == "Select Fr8 Object")
                                  .SingleOrDefault();

            ValidateFr8ObjectCrateStructure(designTimeCrate);
        }
예제 #11
0
        private async Task <ActivityDTO> ConfigureInitial()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var dataDTO = HealthMonitor_FixtureData
                          .Get_Jira_Issue_v1_InitialConfiguration_Fr8DataDTO();

            var activityDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            Assert.IsNotNull(activityDTO);
            Assert.IsNotNull(activityDTO.CrateStorage);

            var crateStorage = Crate.FromDto(activityDTO.CrateStorage);

            Assert.AreEqual(2, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());

            var controls = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().First();

            Assert.AreEqual(1, controls.Controls.Count);
            Assert.AreEqual("TextSource", controls.Controls[0].Type);
            Assert.AreEqual("IssueNumber", controls.Controls[0].Name);

            return(activityDTO);
        }
예제 #12
0
        public async Task SendEmailViaSendGrid_Run_Returns_Payload()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();

            var dataDTO = HealthMonitor_FixtureData.SendEmailViaSendGrid_v1_InitialConfiguration_Fr8DataDTO();


            using (var updatableStorage = Crate.GetUpdatableStorage(dataDTO.ActivityDTO))
            {
                updatableStorage.Add(CreateCrates());
            }

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            AddPayloadCrate(
                dataDTO,
                new StandardPayloadDataCM()
            {
            }
                );

            //Act
            var responsePayloadDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            //Assert
            var crateStorage = Crate.FromDto(responsePayloadDTO.CrateStorage);

            var StandardPayloadDataCM = crateStorage.CrateContentsOfType <StandardPayloadDataCM>().SingleOrDefault();

            Assert.IsNotNull(StandardPayloadDataCM);
        }
        public async Task Post_To_Yammer_Run_Return_Payload()
        {
            //Arrange
            var runUrl      = GetTerminalRunUrl();
            var activityDTO = await ConfigurationRequest();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };

            AddPayloadCrate(
                dataDTO,
                new StandardPayloadDataCM(
                    new KeyValueDTO("message", "Hello")
                    ),
                "Payload crate"
                );

            activityDTO.AuthToken = HealthMonitor_FixtureData.Yammer_AuthToken();

            //Act
            var responsePayloadDTO = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            //Assert
            var crateStorage          = Crate.FromDto(responsePayloadDTO.CrateStorage);
            var StandardPayloadDataCM = crateStorage.CrateContentsOfType <StandardPayloadDataCM>().SingleOrDefault();

            Assert.IsNotNull(StandardPayloadDataCM);
        }
예제 #14
0
        public async Task Monitor_DocuSign_Activate_Returns_ActivityDTO()
        {
            //Arrange
            var configureUrl = GetTerminalActivateUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestDataDTO = await HealthMonitor_FixtureData.Mail_Merge_Into_DocuSign_v1_InitialConfiguration_Fr8DataDTO(this);

            using (var crateStorage = Crate.GetUpdatableStorage(requestDataDTO.ActivityDTO))
            {
                crateStorage.Add("Configuration_Controls", new StandardConfigurationControlsCM());
            }


            //Act
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    requestDataDTO
                    );

            //Assert
            Assert.IsNotNull(responseActionDTO);
            Assert.IsNotNull(Crate.FromDto(responseActionDTO.CrateStorage));
        }
        public async Task ConnectToSql_FollowUp_Configuration_Check_Crate_Structure()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var dataDTO = FixtureData.ConnectToSql_InitialConfiguration_Fr8DataDTO();

            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            using (var updatableStorage = Crate.GetUpdatableStorage(responseActionDTO))
            {
                updatableStorage.RemoveByLabel("Configuration_Controls");
                updatableStorage.Add(CreateConnectionStringCrate());
            }

            dataDTO.ActivityDTO = responseActionDTO;
            responseActionDTO   =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            AssertFollowUpCrateTypes(crateStorage);
        }
        public async Task Monitor_Form_Responses_Initial_Configuration_Check_CM_Structure()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();

            var requestActivityDTO = HealthMonitor_FixtureData.Monitor_Form_Responses_v1_InitialConfiguration_Fr8DataDTO();

            //Act
            var responseActivityDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    requestActivityDTO
                    );

            //Assert
            var crateStorage = Crate.FromDto(responseActivityDTO.CrateStorage);
            var standardConfigurationControlsCM = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().SingleOrDefault();
            var eventSubscriptionCM             = crateStorage.CrateContentsOfType <EventSubscriptionCM>().SingleOrDefault();

            Assert.IsNotNull(standardConfigurationControlsCM, "ActivityDTO storage doesn't contain crate with Standard Configuration Controls.");
            Assert.IsNotNull(eventSubscriptionCM, "ActivityDTO storage doesn't contain crate with Event Subscription.");
            var dropdown = standardConfigurationControlsCM.Controls.FirstOrDefault(s => s.GetType() == typeof(DropDownList));

            Assert.IsNotNull(dropdown, "No Drop Down List Box in the Controls");
            Assert.AreEqual("Selected_Google_Form", dropdown.Name, "The Drop Down List Box control has incorrect Name value.");
            Assert.AreEqual(1, crateStorage.Count(s => s.Label == "Standard Event Subscriptions"), "Number of the crates with Standard Event Subscription is not one.");
        }
        public async Task ConnectToSql_FollowUp_Configuration_No_Connection_String_Check_Crate_Structure()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var dataDTO = FixtureData.ConnectToSql_InitialConfiguration_Fr8DataDTO();

            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            dataDTO.ActivityDTO = responseActionDTO;
            responseActionDTO   =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            AssertConfigureCrate(crateStorage);
        }
        public async Task Monitor_Form_Responses_Initial_Configuration_Check_Crate_Structure()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();

            var dataDTO = HealthMonitor_FixtureData.Monitor_Form_Responses_v1_InitialConfiguration_Fr8DataDTO();

            //Act
            var responseActivityDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            //Assert
            Assert.NotNull(responseActivityDTO, "Call to Initial configuration to " + ActivityName + " returns null.");
            Assert.NotNull(responseActivityDTO.CrateStorage, "Call to Initial configuration to " + ActivityName + " returns ActivityDTO with no CrateStorage.");

            var crateStorage = Crate.FromDto(responseActivityDTO.CrateStorage);

            Assert.AreEqual(3, crateStorage.Count);
            Assert.IsNotNull(crateStorage.FirstCrateOrDefault <CrateDescriptionCM>(x => x.Label == CrateSignaller.RuntimeCrateDescriptionsCrateLabel), "ActivityDTO storage doesn't contain crate with Runtime Crates Descriptions.");
            Assert.IsNotNull(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().SingleOrDefault(), "ActivityDTO storage doesn't contain crate with Standard Configuration Controls.");
            Assert.IsNotNull(crateStorage.CrateContentsOfType <EventSubscriptionCM>().SingleOrDefault(), "ActivityDTO storage doesn't contain crate with Event Subscription.");
        }
예제 #19
0
        private void AssertInitialConfigurationResponse(ActivityDTO responseDTO)
        {
            Assert.NotNull(responseDTO, "Response is null on initial configuration");
            Assert.NotNull(responseDTO.CrateStorage, "Crate storage is null on initial configuration");
            var crateStorage = Crate.FromDto(responseDTO.CrateStorage);

            AssertConfigureCrate(crateStorage);
        }
        private DropDownList GetDropDownListControl(ActivityDTO activityDTO)
        {
            var crateStorage = Crate.FromDto(activityDTO.CrateStorage);
            var controls     = crateStorage.CratesOfType <StandardConfigurationControlsCM>().Single().Content.Controls;
            var ddlb         = (DropDownList)controls.SingleOrDefault(c => c.Type == ControlTypes.DropDownList);

            return(ddlb);
        }
예제 #21
0
        private void AssertInitialConfigurationResponse(ActivityDTO responseDTO)
        {
            Assert.NotNull(responseDTO, "Response is null on initial configuration");
            Assert.NotNull(responseDTO.CrateStorage, "Crate storage is null on initial configuration");
            var crateStorage = Crate.FromDto(responseDTO.CrateStorage);

            AssertConfigurationControls(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single());
        }
예제 #22
0
        private async Task <ActivityDTO> EnsureSolutionAuthenticated(ActivityDTO solution)
        {
            var crateStorage = Crate.FromDto(solution.CrateStorage);
            var stAuthCrate  = crateStorage.CratesOfType <StandardAuthenticationCM>().FirstOrDefault();
            var defaultDocuSignAuthTokenExists = (stAuthCrate == null);

            if (!defaultDocuSignAuthTokenExists)
            {
                var creds = GetDocuSignCredentials();
                creds.Terminal = new TerminalSummaryDTO
                {
                    Name    = solution.ActivityTemplate.TerminalName,
                    Version = solution.ActivityTemplate.TerminalVersion
                };

                var token = await HttpPostAsync <CredentialsDTO, JObject>(
                    _baseUrl + "authentication/token", creds
                    );

                Assert.AreNotEqual(
                    token["error"].ToString(),
                    "Unable to authenticate in DocuSign service, invalid login name or password.", "DocuSign auth error. Perhaps max number of tokens is exceeded."
                    );

                Assert.AreEqual(
                    false,
                    string.IsNullOrEmpty(token["authTokenId"].Value <string>()),
                    "AuthTokenId is missing in API response."
                    );

                var tokenGuid = Guid.Parse(token["authTokenId"].Value <string>());

                var applyToken = new AuthenticationTokenGrantDTO()
                {
                    ActivityId  = solution.Id,
                    AuthTokenId = tokenGuid,
                    IsMain      = true
                };

                await HttpPostAsync <AuthenticationTokenGrantDTO[], string>(
                    _baseUrl + "ManageAuthToken/apply",
                    new AuthenticationTokenGrantDTO[]
                {
                    applyToken
                }
                    );

                solution = await HttpPostAsync <ActivityDTO, ActivityDTO>(
                    _baseUrl + "activities/configure?id=" + solution.Id,
                    solution
                    );
            }

            return(solution);
        }
        public async Task Send_DocuSign_Envelope_Initial_Configuration_Check_Crate_Structure()
        {
            var responseActionDTO = await ConfigureInitial();

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            AssertCrateTypes(crateStorage);
            AssertControls(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single());
        }
        public async Task Monitor_Stat_Initial_Configuration_Check_Crate_Structure()
        {
            var responseDTO = await CompleteInitialConfiguration();

            Assert.NotNull(responseDTO, "Response is null on initial configuration");
            Assert.NotNull(responseDTO.CrateStorage, "Crate storage is null on initial configuration");
            var crateStorage = Crate.FromDto(responseDTO.CrateStorage);

            Assert.AreEqual(2, crateStorage.Count, "Crate storage count is not equal to 2");
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count(), "StandardConfigurationControlsCM count is not 1");

            Assert.AreEqual(2, crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single().Controls.Count, "Control count is not 4");
        }
        public async Task Post_To_Yammer_v1_Initial_Configuration_Check_Crate_Structure()
        {
            // Act
            var responseActionDTO = await ConfigureInitial();

            // Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            AssertCrateTypes(crateStorage);
        }
예제 #26
0
        public async Task Generate_DocuSign_Report_EndToEnd()
        {
            try
            {
                await RevokeTokens();

                // Create Solution plan & initial configuration.
                var plan = await CreateSolution();

                var solution = ExtractSolution(plan);
                solution = await EnsureSolutionAuthenticated(solution);

                var crateStorage = Crate.FromDto(solution.CrateStorage);
                ValidateCrateStructure(crateStorage);
                ValidateConfigurationControls(crateStorage);
                var planConfigure = await GetPlanByActivity(solution.Id);

                ValidatePlanCategory(planConfigure);
                await SaveActivity(solution);

                // FollowUp configuration.
                MockSolutionFollowUpConfigurationData(solution);
                solution = await ConfigureActivity(solution);

                crateStorage = Crate.FromDto(solution.CrateStorage);
                ValidateCrateStructure(crateStorage);
                ValidateConfigurationControls(crateStorage);
                ValidateChildrenActivities(solution);
                ValidateSolutionOperationalState(crateStorage);
                var planFollowup = await GetPlanByActivity(solution.Id);

                ValidatePlanName(planFollowup, crateStorage);
                await SaveActivity(solution);

                // Execute plan.
                var container = await ExecutePlan(plan);

                ValidateContainer(container);


                // Extract container payload.
                var payload = await ExtractContainerPayload(container);

                ValidateContainerPayload(payload);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public async Task Publish_To_Slack_v1_Initial_Configuration_Check_Crate_Structure()
        {
            // Act
            var responseActionDTO = await ConfigureInitial();

            // Assert
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(1, crateStorage.Count, "Configuration response for autheticated call should contain only one crate");
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count(), "Configuration response for autheticated call doesn't contain Standard Configuration Controls crate");
        }
        public async Task Send_Via_Twilio_Run_Send_SMS_With_Correct_Number()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();
            var runUrl       = GetTerminalRunUrl();
            var dataDTO      = HealthMonitor_FixtureData.Send_Via_Twilio_v1_InitialConfiguration_Fr8DataDTO();
            //Act
            var responseActionDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO);

            var crateManager = new CrateManager();

            using (var updatableStorage = crateManager.GetUpdatableStorage(responseActionDTO))
            {
                var curNumberTextSource =
                    (TextSource)
                    updatableStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single().Controls[0];
                curNumberTextSource.ValueSource = "specific";
                curNumberTextSource.TextValue   = ConfigurationManager.AppSettings["TestPhoneNumber"];

                var curBodyTextSource =
                    (TextSource)
                    updatableStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single().Controls[1];
                curBodyTextSource.ValueSource = "specific";
                curBodyTextSource.TextValue   = "That is the body of the message";
            }
            dataDTO.ActivityDTO = responseActionDTO;
            //OperationalStateCM crate is required to be added,
            //as upon return the Run method takes this crate and updates the status to "Success"
            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            var payloadDTO = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            //Assert
            //After Configure Test
            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);
            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);
            var controls     = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single();

            Assert.NotNull(controls.Controls[0] is TextSource);
            Assert.NotNull(controls.Controls[1] is TextSource);
            Assert.AreEqual(false, controls.Controls[0].Selected);
            //After Run Test
            var payload = Crate.FromDto(payloadDTO.CrateStorage).CrateContentsOfType <StandardPayloadDataCM>().Single();

            Assert.AreEqual("Status", payload.PayloadObjects[0].PayloadObject[0].Key);
            Assert.AreNotEqual("failed", payload.PayloadObjects[0].PayloadObject[0].Value);
            Assert.AreNotEqual("undelivered", payload.PayloadObjects[0].PayloadObject[0].Value);
        }
        public async Task Write_To_Sql_Server_FollowUp_Configuration_Check_Crate_Structure_Incorrect_ConnectionString()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var fr8DataDTO = HealthMonitor_FixtureData.Write_To_Sql_Server_v1_InitialConfiguration_Fr8DataDTO();

            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    fr8DataDTO
                    );


            var storage = Crate.GetStorage(responseActionDTO);

            var controlDefinitionDTO =
                storage.CratesOfType <StandardConfigurationControlsCM>()
                .Select(x => x.Content.FindByName("connection_string")).ToArray();

            //provide incorrect connection string
            controlDefinitionDTO[0].Value = FixtureData.TestConnectionString3().Value;

            using (var updatableStorage = Crate.GetUpdatableStorage(responseActionDTO))
            {
                updatableStorage.Replace(storage);
            }
            fr8DataDTO.ActivityDTO = responseActionDTO;
            responseActionDTO      =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    fr8DataDTO
                    );

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);
            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            //There will be no DesignTimeCrate only Configuration crate
            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());
            var controls = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single();

            AssertConfigureControls(controls);
            //Check that Error message is shown
            var connStringTextBox = (TextBox)controls.Controls[0];

            Assert.AreEqual("Incorrect Connection String", connStringTextBox.Value);
        }
        public async Task GetDataFromFr8Warehouse_Run()
        {
            var activityDTO = await ConfigureFollowUp();

            using (var updater = Crate.UpdateStorage(() => activityDTO.CrateStorage))
            {
                var controls     = updater.CrateContentsOfType <StandardConfigurationControlsCM>().First();
                var queryBuilder = controls.FindByName <QueryBuilder>("QueryBuilder");
                queryBuilder.Value = JsonConvert.SerializeObject(
                    new List <FilterConditionDTO>()
                {
                    new FilterConditionDTO()
                    {
                        Field    = "Status",
                        Operator = "eq",
                        Value    = ""
                    }
                }
                    );
            }

            activityDTO.AuthToken = new AuthorizationTokenDTO()
            {
                UserId = Guid.NewGuid().ToString()
            };

            var runUrl = GetTerminalRunUrl();
            var data   = new Fr8DataDTO()
            {
                ActivityDTO = activityDTO
            };

            AddPayloadCrate(data, new OperationalStateCM());

            var payload = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, data);

            Assert.IsNotNull(payload, "PayloadDTO is null");
            Assert.IsNotNull(payload.CrateStorage, "PayloadDTO.CrateStorage is null");

            var crateStorage = Crate.FromDto(payload.CrateStorage);

            Assert.AreEqual(
                1,
                crateStorage.CratesOfType <StandardTableDataCM>()
                .Count(x => x.Label == "Table Generated by Get Data From Fr8 Warehouse"),
                "StandardTableDataCM is expected"
                );
        }