コード例 #1
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);
        }
コード例 #2
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());
        }
コード例 #3
0
        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.");
        }
コード例 #4
0
        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.");
        }
コード例 #5
0
        public async Task Monitor_Form_Responses_Run_WithInvalidPapertrailUrl_ShouldThrowException()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();

            //prepare the activity DTO with valid target URL
            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var activityDTO = fixture.Monitor_Form_Responses_v1_Run_EmptyPayload();
            var dataDTO     = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };

            //Act
            await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);
        }
コード例 #6
0
        public async Task Get_Google_Sheet_Data_v1_Run_No_Auth()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();

            //prepare the action DTO with valid target URL
            var dataDTO = HealthMonitor_FixtureData.Get_Google_Sheet_Data_v1_InitialConfiguration_Fr8DataDTO();

            dataDTO.ActivityDTO.AuthToken = null;

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            //Act
            var payload = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            CheckIfPayloadHasNeedsAuthenticationError(payload);
        }
コード例 #7
0
        public async Task Get_Google_Sheet_Data_Initial_Configuration_Check_Crate_Structure()
        {
            var configureUrl = GetTerminalConfigureUrl();
            var dataDTO      = HealthMonitor_FixtureData.Get_Google_Sheet_Data_v1_InitialConfiguration_Fr8DataDTO();

            dataDTO.ActivityDTO.AuthToken = HealthMonitor_FixtureData.Google_AuthToken1();
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl, dataDTO
                    );

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

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

            AssertCrateTypes_OnConfiguration(crateStorage);
        }
コード例 #8
0
        public async Task Monitor_Form_Responses_Activate_Returns_ActivityDTO()
        {
            //Arrange
            var activateUrl = GetTerminalActivateUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var dataDTO = fixture.Monitor_Form_Responses_v1_ActivateDeactivate_Fr8DataDTO();

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

            //Assert
            Assert.IsNotNull(responseActivityDTO, "Call to Activate for " + ActivityName + " returned null.");
        }
コード例 #9
0
        public async Task Monitor_Form_Responses_Followup_Configuration_Updates_DDLB()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();
            var fixtureData  = new HealthMonitor_FixtureData();
            var dataDTO      = fixtureData.Monitor_Form_Responses_v1_Followup_Fr8DataDTO();
            var initialDDLB  = GetDropDownListControl(dataDTO.ActivityDTO);

            Assert.AreEqual(0, initialDDLB.ListItems.Count(), "Initial configuration of the " + ActivityName + " contains drop down list box with some list items.");
            //initial configuration call
            var followupConfigurationActivityDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                configureUrl,
                dataDTO
                );

            var afterFollowupDDLB = GetDropDownListControl(followupConfigurationActivityDTO);

            Assert.IsNotEmpty(afterFollowupDDLB.ListItems, "Call to Followup configuration of the " + ActivityName + " did not update the drop down list box.");
        }
コード例 #10
0
        public async Task Monitor_Form_Responses_Run_Returns_Payload()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();

            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var activityDTO = fixture.Monitor_Form_Responses_v1_Run_ActivityDTO();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };

            AddPayloadCrate(
                dataDTO,
                new EventReportCM()
            {
                EventPayload = new CrateStorage()
                {
                    Fr8.Infrastructure.Data.Crates.Crate.FromContent(
                        "Response",
                        new StandardPayloadDataCM(
                            new KeyValueDTO("response", "key1=value1&key2=value2")
                            )
                        )
                }
            }
                );
            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            //Act
            var responsePayloadDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

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

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

            Assert.IsNotNull(FieldDescriptionsCM, "Call to Run of the " + ActivityName + " returned ActivityDTO with no crate of Standard Payload Data.");
            var fields = FieldDescriptionsCM.PayloadObjects.SelectMany(s => s.PayloadObject);

            Assert.Greater(fields.Count(), 0, "The number or fields in the Payload Data is zero");
        }
コード例 #11
0
        public async Task Get_Google_Sheet_Data_v1_Run_OneRow_ResponseContainsExtractedFields()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();
            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestActionDTO = fixture.Get_Google_Sheet_Data_v1_Followup_Configuration_Request_ActivityDTO_With_Crates();

            fixture.Get_Google_Sheet_Data_v1_AddPayload(requestActionDTO, "OneRow_WithHeader");
            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            ////Act
            var response = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var storage        = Crate.GetStorage(response);
            var tableDataCrate = storage.CratesOfType <StandardTableDataCM>().Single();

            ////Assert
            Assert.AreEqual("Spreadsheet Data from \"OneRow_WithHeader\"", tableDataCrate.Label);
        }
コード例 #12
0
        public async Task Monitor_Form_Responses_Initial_Configuration_Check_Source_Fields()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();

            var dataDTO = HealthMonitor_FixtureData.Monitor_Form_Responses_v1_InitialConfiguration_Fr8DataDTO();

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

            //Assert
            var crateStorage = Crate.FromDto(responseActivityDTO.CrateStorage);
            var controls     = crateStorage.FirstCrateOrDefault <StandardConfigurationControlsCM>()?.Content;

            Assert.IsNotNull(controls, "Controls crate is missing");
            var control = controls.Controls.FirstOrDefault(x => x.Name == "Selected_Google_Form") as DropDownList;

            Assert.IsNotNull(control, "Select Form control is missing");
            Assert.Greater(control.ListItems.Count, 0, "No Google form were loaded into DDLB control");
        }