public void ToConfirmIntegrationFormCase_GivenStreetSupplied_ShouldAddDataToCaseFields()
        {
            var usrn        = "USRN";
            var description = "Name";
            var furtherLocationInformation = "FurtherLocationInformation";

            var caseLove = new Case
            {
                Customer = new Customer(),
                Street   = new Street
                {
                    USRN        = usrn,
                    Description = description
                },
                FurtherLocationInformation = furtherLocationInformation
            };

            var configuration = new ConfirmIntegrationFormOptions();

            var result = caseLove.ToConfirmIntegrationFormCase(configuration);

            Assert.NotEmpty(result.FormData);
            Assert.Equal(usrn, result.FormData.FirstOrDefault(_ => _.Key == "CONF_SITE_CODE").Value);
            Assert.Equal(description, result.FormData.FirstOrDefault(_ => _.Key == "CONF_SITE_NAME").Value);
            Assert.Equal(furtherLocationInformation, result.FormData.FirstOrDefault(_ => _.Key == "CONF_LOCATION").Value);
        }
 public DroppedKerbService(IVerintServiceGateway verintServiceGateway,
                           IMailHelper mailHelper,
                           IOptions <VerintOptions> verintOptions,
                           IOptions <ConfirmIntegrationFormOptions> VOFConfiguration)
 {
     _verintServiceGateway = verintServiceGateway;
     _mailHelper           = mailHelper;
     _verintOptions        = verintOptions.Value;
     _VOFConfiguration     = VOFConfiguration.Value;
 }
        public void ToConfirmIntegrationFormCase_GivenStreetSupplied_AndDescriptionIsNull_ShouldThrowException()
        {
            var caseLove = new Case
            {
                Customer = new Customer(),
                Street   = new Street()
            };

            var configuration = new ConfirmIntegrationFormOptions();

            Assert.Throws <Exception>(() => caseLove.ToConfirmIntegrationFormCase(configuration));
        }
        public void ToConfirmIntegrationFormCase_GivenAddressDescriptionIsNull_ShouldThrowException()
        {
            var caseLove = new Case
            {
                Customer = new Customer
                {
                    Address = new Address()
                }
            };

            var configuration = new ConfirmIntegrationFormOptions();

            Assert.Throws <Exception>(() => caseLove.ToConfirmIntegrationFormCase(configuration));
        }
        public void ToConfirmIntegrationFormCase_GivenIsNotSmbcEmployee_ShouldAddCaseFields()
        {
            var caseLove = new Case
            {
                Customer       = new Customer(),
                IsSMBCEmployee = false
            };

            var configuration = new ConfirmIntegrationFormOptions();

            var result = caseLove.ToConfirmIntegrationFormCase(configuration);

            Assert.NotEmpty(result.FormData);
            Assert.Equal("WEB", result.FormData.FirstOrDefault(_ => _.Key == "CONF_METH_CODE").Value);
            Assert.Equal("Web/Online Form", result.FormData.FirstOrDefault(_ => _.Key == "CONF_METH_NAME").Value);
        }
        public void ToConfirmIntegrationFormCase_GivenIsSmbcEmployee_ShouldAddCaseFields()
        {
            var caseLove = new Case
            {
                Customer       = new Customer(),
                IsSMBCEmployee = true
            };

            var configuration = new ConfirmIntegrationFormOptions();

            var result = caseLove.ToConfirmIntegrationFormCase(configuration);

            Assert.NotEmpty(result.FormData);
            Assert.Equal("SHOT", result.FormData.FirstOrDefault(_ => _.Key == "CONF_POC_CODE").Value);
            Assert.Equal("Customer Service Centre", result.FormData.FirstOrDefault(_ => _.Key == "CONF_POC_NAME").Value);
        }
        public void ToConfirmIntegrationFormCase_GivenAddressIsNull_ShouldNotNameCaseFields()
        {
            var caseLove = new Case
            {
                Customer = new Customer()
            };

            var configuration = new ConfirmIntegrationFormOptions();

            var result = caseLove.ToConfirmIntegrationFormCase(configuration);

            Assert.NotEmpty(result.FormData);
            Assert.False(result.FormData.Keys.Contains("CONF_CUST_LOCALITY"));
            Assert.False(result.FormData.Keys.Contains("CONF_CUST_TOWN"));
            Assert.False(result.FormData.Keys.Contains("CONF_CUST_COUNTY"));
            Assert.False(result.FormData.Keys.Contains("CONF_CUST_POSTCODE"));
        }
        public void ToConfirmIntegrationFormCase_GivenDifferentSmbcChannels_ShouldAddRelevantCaseFields(string channel, string methodName, string methodCode)
        {
            var caseLove = new Case
            {
                Customer       = new Customer(),
                IsSMBCEmployee = true,
                SMBCChannel    = channel
            };

            var configuration = new ConfirmIntegrationFormOptions();

            var result = caseLove.ToConfirmIntegrationFormCase(configuration);

            Assert.NotEmpty(result.FormData);
            Assert.Equal(methodName, result.FormData.FirstOrDefault(_ => _.Key == "CONF_METH_NAME").Value);
            Assert.Equal(methodCode, result.FormData.FirstOrDefault(_ => _.Key == "CONF_METH_CODE").Value);
        }
        public void ToConfirmIntegrationFormCase_ShouldRemoveEmptyFields()
        {
            var caseLove = new Case
            {
                Customer = new Customer(),
                Property = new Address
                {
                    Description = "Description",
                    USRN        = string.Empty
                }
            };

            var configuration = new ConfirmIntegrationFormOptions();

            var result = caseLove.ToConfirmIntegrationFormCase(configuration);

            Assert.NotEmpty(result.FormData);
            Assert.False(result.FormData.Keys.Contains("CONF_SITE_CODE"));
        }
예제 #10
0
        public static Case ToCase(this AbandonedVehicleReport model,
                                  ConfirmIntegrationFormOptions _VOFConfiguration,
                                  VerintOptions _verintOptions)
        {
            var crmCase = new Case
            {
                EventCode                  = _VOFConfiguration.EventId,
                EventTitle                 = _verintOptions.EventTitle,
                Classification             = _verintOptions.Classification,
                RaisedByBehaviour          = RaisedByBehaviourEnum.Individual,
                FurtherLocationInformation = model.FurtherDetails,
                Description                = GenerateDescription(model),
                Customer = new Customer
                {
                    Forename  = model.FirstName,
                    Surname   = model.LastName,
                    Email     = model.Email,
                    Telephone = model.Phone,
                    Address   = new Address
                    {
                        AddressLine1 = model.CustomersAddress.AddressLine1,
                        AddressLine2 = model.CustomersAddress.AddressLine2,
                        City         = model.CustomersAddress.Town,
                        Postcode     = model.CustomersAddress.Postcode,
                        UPRN         = model.CustomersAddress.PlaceRef,
                        Description  = model.CustomersAddress.ToString()
                    }
                }
            };

            if (!string.IsNullOrWhiteSpace(model.StreetAddress?.PlaceRef))
            {
                crmCase.AssociatedWithBehaviour = AssociatedWithBehaviourEnum.Street;
                crmCase.Street = new Street
                {
                    Reference   = model.StreetAddress.PlaceRef,
                    Description = model.StreetAddress.ToString()
                };
            }

            return(crmCase);
        }