Example #1
0
        public void FillForm(RegistrationFormModels user)
        {
            /* this.WaitForLoad();
             * Thread.Sleep(1000);*/
            CustomerFirstName.SendKeys(user.CustomerFirstName);
            CustomerLastName.SendKeys(user.CustomerLastName);
            CustomerPassword.SendKeys(user.CustomerPassword);
            CustomerAddress.SendKeys(user.CustomerAddress);
            SelectElement years = new SelectElement(YearDD);

            years.SelectByValue(user.Year);
            SelectElement months = new SelectElement(MonthsDD);

            months.SelectByValue(user.Month);
            SelectElement days = new SelectElement(DaysDD);

            days.SelectByValue(user.Day);
            CustomerAddress.SendKeys(user.CustomerAddress);
            CustomerCity.SendKeys(user.CustomerCity);
            CustomerState.SendKeys(user.CustomerState);
            CustomerPostCode.SendKeys(user.CustomerPostCode);
            CustomerPhoneMobile.SendKeys(user.CustomerPhoneMobile);
            CustomerGender.Click();
            FindSubmitField.Click();
        }
Example #2
0
        internal string ValidCustomerFirstName()//Validate the User FirstName
        {
            Console.WriteLine("FirstName : ");
            CustomerFirstName = Console.ReadLine();

            if (CustomerFirstName.Length < 2 && CustomerFirstName.Length > 20)//Checks for the customer name length
            {
                Console.WriteLine("The name is not valid try again..");
                CustomerFirstName = ValidCustomerFirstName();
            }
            Regex check  = new Regex(@"([A-Z][a-z-A-Z])");
            bool  valid  = check.IsMatch(CustomerFirstName);
            Regex check1 = new Regex(@"([0-9])");

            if (check1.IsMatch(CustomerFirstName) == true)
            {
                valid = false;
            }
            char[] charName = CustomerFirstName.ToCharArray();
            for (int i = 0; i < charName.Length - 2; i++)
            {
                if ((charName[i] == charName[i + 1]) && (charName[i + 1] == charName[i + 2]))
                {
                    valid = false;
                    break;
                }
            }
            if ((valid == false))
            {
                Console.WriteLine("Name is Invalid..");
                CustomerFirstName = ValidCustomerFirstName();
            }
            return(CustomerFirstName);
        }
Example #3
0
        public async Task <IActionResult> RegisterCustomer(CustomerRegistrationDto registrationDto)
        {
            Result <CustomerFirstName>   customerFirstNameOrError = CustomerFirstName.Create(registrationDto.FirstName);
            Result <CustomerLastName>    customerLastNameOrError  = CustomerLastName.Create(registrationDto.LastName);
            Result <CustomerDateOfBirth> customerDOBOrError       = CustomerDateOfBirth.Create(registrationDto.DateOfBirth);
            Result <Email> emailOrError = Email.Create(registrationDto.Email);
            Result <PolicyReferenceNumber> policyReferenceOrError = PolicyReferenceNumber.Create(registrationDto.PolicyReferenceNumber);
            var result = Result.Combine(customerFirstNameOrError,
                                        customerLastNameOrError,
                                        customerDOBOrError,
                                        emailOrError,
                                        policyReferenceOrError);

            if (result.IsFailure)
            {
                return(BadRequest(result.Error));
            }
            var customerEntity = _mapper.Map <Customer>(registrationDto);
            await _customerRepository.AddItemAsync(customerEntity);

            await _customerRepository.SaveAsync();

            var customerToReturn = _mapper.Map <CustomerDto>(customerEntity);

            _logger.LogInformation($"a customer id {customerToReturn.Id} is registered");
            return(CreatedAtRoute("GetCustomer", new { id = customerToReturn.Id }, customerToReturn));
        }
 public void FillForm(RegistrationUser user)
 {
     RadioButtons[0].Click();
     CustomerFirstName.SendKeys(user.FirstName);
     CustomerLastName.SendKeys(user.LastName);
     Password.SendKeys(user.Password);
     Days.SelectByValue(user.Date);
     Months.SelectByValue(user.Month);
     Years.SelectByValue(user.Year);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     PostCode.SendKeys(user.PostCode);
     Phone.SendKeys(user.Phone);
     RegisterButton.Click();
 }
Example #5
0
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Customer>(x =>
     {
         x.Property(p => p.Email)
         .HasConversion(p => p.Value, p => Email.Create(p).Value);
         x.Property(p => p.DateOfBirth)
         .HasConversion(p => p.Value, p => CustomerDateOfBirth.Create(p).Value);
         x.Property(p => p.PolicyReferenceNumber)
         .HasConversion(p => p.Value, p => PolicyReferenceNumber.Create(p).Value);
         x.Property(p => p.FirstName)
         .HasConversion(p => p.Value, p => CustomerFirstName.Create(p).Value);
         x.Property(p => p.LastName)
         .HasConversion(p => p.Value, p => CustomerLastName.Create(p).Value);
     });
 }
        public CustomerProfile()
        {
            CreateMap <Models.CustomerRegistrationDto, Entities.Customer>()
            .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => CustomerFirstName.Create(src.FirstName).Value))
            .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => CustomerLastName.Create(src.LastName).Value))
            .ForMember(dest => dest.PolicyReferenceNumber, opt => opt.MapFrom(src => PolicyReferenceNumber.Create(src.PolicyReferenceNumber).Value))
            .ForMember(dest => dest.DateOfBirth, opt => opt.MapFrom(src => CustomerDateOfBirth.Create(src.DateOfBirth).Value))
            .ForMember(dest => dest.Email, opt => opt.MapFrom(src => Email.Create(src.Email).Value));
            CreateMap <Entities.Customer, Models.CustomerRegistrationDto>()
            .ForMember(dest => dest.DateOfBirth, opt => opt.MapFrom(src => src.DateOfBirth.Value))
            .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.Email.Value))
            .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName.Value))
            .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.LastName.Value))
            .ForMember(dest => dest.PolicyReferenceNumber, opt => opt.MapFrom(src => src.PolicyReferenceNumber.Value));

            CreateMap <Entities.Customer, Models.CustomerDto>();
        }
 public void FillForm(User user)
 {
     RadioButtons[0].Click();
     CustomerFirstName.SendKeys(user.FirstName);
     CustomerLastName.SendKeys(user.LastName);
     Password.SendKeys(user.Password);
     Days.SelectByValue(user.Day);
     Months.SelectByValue(user.Month);
     Years.SelectByValue(user.Year);
     FirstName.SendKeys(user.AddressFirstName);
     LastName.SendKeys(user.AddressLastName);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     PostCode.SendKeys(user.Postalcode);
     Phone.SendKeys(user.MobilePhone);
     Alias.SendKeys(user.Alias);
 }
 public void FillForm(RegistrationUser user)
 {
     RadioButtons.Click();
     CustomerFirstName.Type(user.FirstName);
     CustomerLastName.Type(user.LastName);
     Password.Type(user.Password);
     //Days.SelectByText(user.Date);
     //Months.SelectByText(user.Month);
     //Years.SelectByText(user.Year);
     FirstName.Type(user.RealFirstName);
     LastName.Type(user.RealLastName);
     Address.Type(user.Address);
     City.Type(user.City);
     State.SelectByText(user.State);
     Zip.Type(user.Zip);
     Phone.Type(user.Phone);
     Alias.Type(user.Alias);
     RegisterButton.Click();
 }
Example #9
0
 public void FillFormEmail(UserProperty user)
 {
     Radiobuttons[0].Click();
     CustomerFirstName.SendKeys(user.FirstName);
     CustomerLastName.SendKeys(user.LastName);
     passwordField.SendKeys(user.Password);
     Days.SelectByValue(user.Day);
     Months.SelectByValue(user.Month);
     Years.SelectByValue(user.Year);
     FirstName.SendKeys(user.AdressFirstName);
     LastName.SendKeys(user.AddressLastName);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     PostCode.SendKeys(user.Postalcode);
     Phone.SendKeys(user.Phone);
     Alias.SendKeys(user.Alias);
     Email.Clear();
     RegisterButton.Click();
 }
        public void FillForm(RegistrationUser user)
        {
            Titles[user.Title].Click();
            CustomerFirstName.Type(user.CustomerFirstName);
            CustomerLastName.Type(user.CustomerLastName);
            Password.Type(user.Password);
            Days.SelectByValue(user.Day);
            Months.SelectByValue(user.Month);
            Years.SelectByValue(user.Year);
            FirstName.Type(user.FirstName);
            LastName.Type(user.LastName);
            Company.Type(user.Address);
            Address.Type(user.Address);
            Country.SelectByText(user.Country);
            State.SelectByText(user.State);
            City.Type(user.City);
            Postcode.Type(user.Postcode);
            MobilePhone.Type(user.MobilePhone);

            registerSubmit.Click();
        }
        public void FillForm(RegistrationUser user)
        {
            Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);

            RadioButtons[1].Click();
            CustomerFirstName.SendKeys(user.FirstName);
            CustomerLastName.SendKeys(user.LastName);
            Password.SendKeys(user.Password);
            Days.SelectByValue(user.Date);
            Months.SelectByValue(user.Month);
            Years.SelectByValue(user.Year);
            RealFirstName.SendKeys(user.RealFirstName);
            RealLastName.SendKeys(user.RealLastName);
            Address.SendKeys(user.Address);
            City.SendKeys(user.City);
            State.SelectByText(user.State);
            PostCode.SendKeys(user.PostCode);
            Phone.SendKeys(user.Phone);
            Alias.Type(user.Alias);
            RegisterButton.Click();
        }