Exemple #1
0
        public static CoveragesPage AddDriver(this DriverEnterPage driverEnterPage, DriverInformation[] driverList)
        {
            ParameterValidator.ValidateNotNull(driverList, "Driver List");

            AddAnotherDriverPage addAnotherDriverPage = new AddAnotherDriverPage();

            for (int i = 0; i < driverList.Length; i++)
            {
                //9. Add vehicle
                if (driverList[i].DoesNotDrive)
                {
                    driverEnterPage.AddDriver <DriverEnterPage>(driverList[i]);
                }
                else
                {
                    driverEnterPage.AddDriver(driverList[i]);
                    if (i != driverList.Length - 1)
                    {
                        //10. Yes more driver
                        addAnotherDriverPage.YesMoreDriver();
                    }
                    else
                    {
                        //10. No more driver
                        addAnotherDriverPage.NoMoreDriver();
                    }
                }
            }
            return(new CoveragesPage());
        }
Exemple #2
0
        public static SummaryPage CreateQuote(this WelcomePage wellcomePage, Quote quote)
        {
            ParameterValidator.ValidateNotNull(wellcomePage, "WellcomePage");
            ParameterValidator.ValidateNotNull(quote, "Quote");

            //1. Start new submission
            BusinessClassificationPage businessClassificationPage = wellcomePage.StartNewSubmission();
            //2. Enter business infomation
            EffectiveDatePage effectiveDatePage = businessClassificationPage.EnterBusinessInformation(quote.BusinessClassification);

            //3. Enter policy level vehicle info
            VehicleInfoPage vehicleInfoPage = effectiveDatePage.EnterCustomerInformation(quote.CustomerInformation);

            //4. Enter policy level vehicle info
            VehicleEntryPage vehicleEntryPage = vehicleInfoPage.EnterPolicyLevelVehicleInfo <VehicleEntryPage>(quote.PolicyLevelVehicleInformation);

            //5. Add vehicles
            AddAnotherVehiclePage addAnotherVehiclePage = new AddAnotherVehiclePage();

            for (int i = 0; i < quote.VehicleList.Length; i++)
            {
                vehicleEntryPage.AddVehicle(quote.VehicleList[i]);
                if (i == quote.VehicleList.Length - 1)
                {
                    addAnotherVehiclePage.NoMoreVehicle();
                }
                else
                {
                    addAnotherVehiclePage.YesMoreVehicle();
                }
            }

            //6. Add driver
            DriverEnterPage      driverEnterPage      = new DriverEnterPage();
            AddAnotherDriverPage addAnotherDriverPage = new AddAnotherDriverPage();

            for (int i = 0; i < quote.DriverList.Length; i++)
            {
                if (quote.DriverList[i].DoesNotDrive)
                {
                    driverEnterPage.AddDriver <DriverEnterPage>(quote.DriverList[i]);
                }
                else
                {
                    driverEnterPage.AddDriver(quote.DriverList[i]);
                    if (i == quote.DriverList.Length - 1)
                    {
                        addAnotherDriverPage.NoMoreDriver();
                    }
                    else
                    {
                        addAnotherDriverPage.YesMoreDriver();
                    }
                }
            }

            //7. Select coverage limits
            CoveragesPage coveragesPage = new CoveragesPage();

            if (quote.CoverageLimits != null)
            {
                coveragesPage.SelectCoverageLimits(quote.CoverageLimits).SelectCalculateButton().SelectNextButton();
            }
            else
            {
                coveragesPage.UseDefaultCoverages();
            }

            //8. Select Additional Coverages
            AdditionalCoveragesPage additionalCoveragesPage = new AdditionalCoveragesPage();

            additionalCoveragesPage.SelectAdditionalCoverages <SummaryPage>(quote.AdditionalCoverages);

            //9. Enter Additional Coverages(if needed)
            SummaryPage summaryPage = additionalCoveragesPage.EnterAdditionalCoverages(quote.AdditionalCoverages);

            return(summaryPage);
        }