コード例 #1
0
        public void ToConfirmFloodingIntegrationFormCase_ShouldReturnPopulatedVerintOnlineFormRequest_With_FloodingData()
        {
            var caseLove = new Case
            {
                Customer = new Customer()
            };

            var configuration = new ConfirmFloodingIntegrationFormOptions
            {
                EventId                = 1,
                XCoordinate            = "12345",
                YCoordinate            = "54321",
                FloodingSourceReported = "NK",
                LocationOfFlooding     = "STREET",
                DomesticOrCommercial   = "DOM"
            };

            var result = caseLove.ToConfirmFloodingIntegrationFormCase(configuration);

            Assert.NotNull(result);
            Assert.NotEmpty(result.FormData);
            Assert.True(result.FormData.ContainsKey("CONF_X_COORD"));
            Assert.True(result.FormData.ContainsKey("CONF_Y_COORD"));
            Assert.True(result.FormData.ContainsKey("CONF_ATTRIBUTE_FSRC_CODE"));
            Assert.True(result.FormData.ContainsKey("CONF_ATTRIBUTE_FLOC_CODE"));
            Assert.True(result.FormData.ContainsKey("CONF_ATTRIBUTE_FDOC_CODE"));
        }
コード例 #2
0
        public static FloodingConfiguration ToConfig(this FloodingRequest request, ConfirmAttributeFormOptions attributesFormOptions, VerintOptions verintOptions)
        {
            var verintConfigValue = request.WhatDoYouWantToReport.Equals("flood") ? request.WhereIsTheFlood : request.WhatDoYouWantToReport;
            var verintConfig      = verintOptions.Options.First(_ => _.Type.Equals(verintConfigValue));

            var formOptions = new ConfirmFloodingIntegrationFormOptions
            {
                EventId     = verintConfig.EventCode,
                ClassCode   = verintConfig.ClassCode,
                ServiceCode = verintConfig.ServiceCode,
                SubjectCode = verintConfig.SubjectCode
            };

            formOptions.FloodingSourceReported = attributesFormOptions.FloodingSourceReported.FirstOrDefault(_ => _.Type.Equals(request.WhereIsTheFloodingComingFrom))?.Value ?? string.Empty;
            formOptions.DomesticOrCommercial   = attributesFormOptions.CommercialOrDomestic.FirstOrDefault(_ => _.Type.Equals(request.WhereIsTheFlood))?.Value ?? string.Empty;

            if (request.WhereIsTheFlood.Equals("home"))
            {
                if (request.WhereInThePropertyIsTheFlood.Equals("garage"))
                {
                    formOptions.LocationOfFlooding =
                        attributesFormOptions.FloodLocationInProperty.First(_ =>
                                                                            _.Type.Equals(request.IsTheGarageConnectedToYourHome)).Value;
                }
                else
                {
                    formOptions.LocationOfFlooding = attributesFormOptions.FloodLocationInProperty
                                                     .First(_ => _.Type.Equals(request.WhereInThePropertyIsTheFlood)).Value;
                }
            }

            if (request.WhereIsTheFlood.Equals("business"))
            {
                if (request.IsTheFloodInsideOrOutsideProperty.Equals("inside"))
                {
                    formOptions.LocationOfFlooding = attributesFormOptions.FloodLocationInProperty
                                                     .First(_ => _.Type.Equals(request.WhereInThePropertyIsTheFlood)).Value;
                }
                else
                {
                    formOptions.LocationOfFlooding = attributesFormOptions.FloodLocationInProperty
                                                     .First(_ => _.Type.Equals("garden")).Value;
                }
            }

            formOptions.XCoordinate = request.Map?.Lng;
            formOptions.YCoordinate = request.Map?.Lat;

            return(new FloodingConfiguration
            {
                ConfirmIntegrationFormOptions = formOptions,
                VerintOption = verintConfig
            });
        }