public void TestEventFeeWithDiscountCodeAccessCode()
        {
            evt = new Event("TestEventFeeWithDiscountCodeAccessCode");
            paymentMethod = new PaymentMethod(FormData.PaymentMethod.Check);
            evt.CheckoutPage.PaymentMethods.Add(paymentMethod);
            EventFee ef = new EventFee();
            ef.StandardPrice = 100;
            CustomFieldCode dc1 = new CustomFieldCode("dc1");
            dc1.Amount = 10;
            dc1.CodeDirection = FormData.ChangePriceDirection.Decrease;
            dc1.CodeKind = FormData.ChangeType.FixedAmount;
            dc1.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            CustomFieldCode ac1 = new CustomFieldCode("ac1");
            ac1.CodeType = FormData.CustomFieldCodeType.AccessCode;
            ef.AllCustomCodes.Add(dc1);
            ef.AllCustomCodes.Add(ac1);
            evt.StartPage.Event_Fee = ef;

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, evt);
            Registrant reg1 = new Registrant(evt);
            reg1.Payment_Method = paymentMethod;
            reg1.EventFee_Response = new EventFeeResponse();
            reg1.EventFee_Response.Code = dc1;
            KeywordProvider.RegistrationCreation.CreateRegistration(reg1);
            Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 90);
            Registrant reg2 = new Registrant(evt);
            reg2.Payment_Method = paymentMethod;
            reg2.EventFee_Response = new EventFeeResponse();
            reg2.EventFee_Response.Code = ac1;
            KeywordProvider.RegistrationCreation.CreateRegistration(reg2);
            Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 100);
        }
        public void TestAccessCode()
        {
            evt = new Event("AccessCodeFixture");
            paymentMethod = new PaymentMethod(FormData.PaymentMethod.Check);
            evt.CheckoutPage.PaymentMethods.Add(paymentMethod);
            regType = new RegType("RegType");
            regType.Price = 50;
            CustomFieldCode ac1 = new CustomFieldCode("ac1");
            ac1.CodeType = FormData.CustomFieldCodeType.AccessCode;
            ac1.Limit = 2;
            regType.AllCustomCodes.Add(ac1);
            CustomFieldCode ac2 = new CustomFieldCode("ac2");
            ac2.CodeType = FormData.CustomFieldCodeType.AccessCode;
            regType.AllCustomCodes.Add(ac2);
            evt.StartPage.RegTypes.Add(regType);

            agenda = new AgendaItem_CheckBox("Agenda");
            agenda.Price = 80;
            CustomFieldCode ac3 = new CustomFieldCode("ac3");
            ac3.CodeType = FormData.CustomFieldCodeType.AccessCode;
            ac3.Limit = 2;
            CustomFieldCode ac4 = new CustomFieldCode("ac4");
            ac4.CodeType = FormData.CustomFieldCodeType.AccessCode;
            agenda.DiscountCodes.Add(ac3);
            agenda.DiscountCodes.Add(ac4);
            agenda.BulkCodes = CustomFieldCode.GenerateBulkCodes(agenda.DiscountCodes);
            evt.AgendaPage = new AgendaPage();
            evt.AgendaPage.AgendaItems.Add(agenda);

            merch = new MerchandiseItem("Merch");
            merch.Type = FormData.MerchandiseType.Fixed;
            merch.Price = 110;
            CustomFieldCode ac5 = new CustomFieldCode("ac5");
            ac5.CodeType = FormData.CustomFieldCodeType.AccessCode;
            merch.DiscountCodes.Add(ac5);
            evt.MerchandisePage = new MerchandisePage();
            evt.MerchandisePage.Merchandises.Add(merch);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, evt, false, true);

            Registrant reg1 = this.GenerateReg(ac1, ac3, ac5);
            KeywordProvider.RegistrationCreation.CreateRegistration(reg1);
            Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 240);
            Registrant reg2 = this.GenerateReg(ac1, ac3, ac5);
            KeywordProvider.RegistrationCreation.CreateRegistration(reg2);
            Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 240);
            Registrant reg3 = this.GenerateReg(ac1, ac4, ac5);
            KeywordProvider.RegistrationCreation.Checkin(reg3);
            Assert.True(KeywordProvider.RegisterDefault.HasErrorMessage(string.Format(Messages.RegisterError.RegTypeCodeLimitHasReached, ac1.CodeString)));
            Registrant reg4 = this.GenerateReg(ac2, ac3, ac5);
            KeywordProvider.RegistrationCreation.Checkin(reg4);
            KeywordProvider.RegistrationCreation.PersonalInfo(reg4);
            KeywordProvider.RegistrationCreation.Agenda(reg4);
            Assert.True(KeywordProvider.RegisterDefault.HasErrorMessage(Messages.RegisterError.AgendaCodeLimitReached));
            Registrant reg5 = this.GenerateReg(ac2, ac4, ac5);
            KeywordProvider.RegistrationCreation.CreateRegistration(reg5);
            Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 240);
        }
 public void TestRegTypeWithDiscountCodeAccessCode()
 {
     evt = new Event("TestRegTypeWithDiscountCodeAccessCode");
     paymentMethod = new PaymentMethod(FormData.PaymentMethod.Check);
     evt.CheckoutPage.PaymentMethods.Add(paymentMethod);
     //regtype1 no price
     RegType regType1 = new RegType("RegType1");
     //regtype2 has price, no code
     RegType regType2 = new RegType("RegType2");
     regType2.Price = 10;
     //regtype2 has price, has code
     RegType regType3 = new RegType("RegType3");
     regType3.Price = 100;
     CustomFieldCode dc1 = new CustomFieldCode("dc1");
     dc1.Amount = 10;
     dc1.CodeDirection = FormData.ChangePriceDirection.Decrease;
     dc1.CodeKind = FormData.ChangeType.FixedAmount;
     dc1.CodeType = FormData.CustomFieldCodeType.DiscountCode;
     CustomFieldCode ac1 = new CustomFieldCode("ac1");
     ac1.CodeType = FormData.CustomFieldCodeType.AccessCode;
     regType3.AllCustomCodes.Add(dc1);
     regType3.AllCustomCodes.Add(ac1);
     evt.StartPage.RegTypes.Add(regType1);
     evt.StartPage.RegTypes.Add(regType2);
     evt.StartPage.RegTypes.Add(regType3);
     KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, evt);
     Registrant reg1 = new Registrant(evt);
     reg1.Payment_Method = paymentMethod;
     reg1.EventFee_Response = new EventFeeResponse(regType1);
     KeywordProvider.RegistrationCreation.CreateRegistration(reg1);
     Assert.False(PageObject.PageObjectProvider.Register.RegistationSite.Confirmation.Total.IsPresent);
     Registrant reg2 = new Registrant(evt);
     reg2.Payment_Method = paymentMethod;
     reg2.EventFee_Response = new EventFeeResponse(regType2);
     KeywordProvider.RegistrationCreation.CreateRegistration(reg2);
     Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 10);
     Registrant reg3 = new Registrant(evt);
     reg3.Payment_Method = paymentMethod;
     reg3.EventFee_Response = new EventFeeResponse(regType3);
     reg3.EventFee_Response.Code = dc1;
     KeywordProvider.RegistrationCreation.CreateRegistration(reg3);
     Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 90);
     Registrant reg4 = new Registrant(evt);
     reg4.Payment_Method = paymentMethod;
     reg4.EventFee_Response = new EventFeeResponse(regType3);
     reg4.EventFee_Response.Code = ac1;
     KeywordProvider.RegistrationCreation.CreateRegistration(reg4);
     Assert.True(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation) == 100);
 }
        private Registrant GenerateReg(CustomFieldCode regTypeDc, CustomFieldCode agendaDc, CustomFieldCode merchDc)
        {
            Registrant reg = new Registrant(evt);
            reg.Payment_Method = paymentMethod;
            reg.EventFee_Response = new EventFeeResponse(regType);
            reg.EventFee_Response.Code = regTypeDc;
            AgendaResponse_Checkbox resp1 = new AgendaResponse_Checkbox();
            resp1.AgendaItem = agenda;
            resp1.Checked = true;
            resp1.Code = agendaDc;
            reg.CustomField_Responses.Add(resp1);
            MerchResponse_FixedPrice resp2 = new MerchResponse_FixedPrice();
            resp2.Merchandise_Item = merch;
            resp2.Quantity = 1;
            resp2.Discount_Code = merchDc;
            reg.Merchandise_Responses.Add(resp2);

            return reg;
        }
        public void AddDiscountCodes(CustomFieldCode code, FormData.Location location)
        {
            switch(location)
            {
                case FormData.Location.EventFee:
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.AddDiscountCode_Click();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.SelectByName();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.Code.Type(code.CodeString);

                    switch (code.CodeType)
                    {
                        case FormData.CustomFieldCodeType.DiscountCode:
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.Discount_Click();
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.CodeDirection.SelectWithText(code.CodeDirection.Value.ToString());

                            if (code.CodeKind == FormData.ChangeType.Percent)
                            {
                                PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.Percentage_Click();
                            }

                            if (code.CodeKind == FormData.ChangeType.FixedAmount)
                            {
                                PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.FixAmount_Click();
                            }

                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.Amount.Type(code.Amount);
                            break;

                        case FormData.CustomFieldCodeType.AccessCode:
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.Access_Click();
                            break;

                        default:
                            break;
                    }

                    if (code.Limit.HasValue)
                    {
                        PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.UseLimit.Type(code.Limit.Value);
                    }

                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.Code_Define.SaveAndClose_Click();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.EventFeeDefine.SelectByName();
                    break;

                case FormData.Location.RegType:
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.AddDiscountCode_Click();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.SelectByName();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.Code.Type(code.CodeString);

                    switch (code.CodeType)
                    {
                        case FormData.CustomFieldCodeType.DiscountCode:
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.Discount_Click();
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.CodeDirection.SelectWithText(code.CodeDirection.Value.ToString());

                            if (code.CodeKind == FormData.ChangeType.Percent)
                            {
                                PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.Percentage_Click();
                            }

                            if (code.CodeKind == FormData.ChangeType.FixedAmount)
                            {
                                PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.FixAmount_Click();
                            }

                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.Amount.Type(code.Amount);
                            break;

                        case FormData.CustomFieldCodeType.AccessCode:
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.Access_Click();
                            break;

                        default:
                            break;
                    }

                    if (code.Limit.HasValue)
                    {
                        PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.UseLimit.Type(code.Limit.Value);
                    }

                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.Code_Define.SaveAndClose_Click();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.StartPage.RegTypeDefine.RegTypeFee_Define.SelectByName();
                    break;

                case FormData.Location.Agenda:
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.AddDiscountCode_Click();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.SelectByName();
                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.Code.Type(code.CodeString);

                    switch (code.CodeType)
                    {
                        case FormData.CustomFieldCodeType.DiscountCode:
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.Discount_Click();
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.CodeDirection.SelectWithText(code.CodeDirection.Value.ToString());

                            if (code.CodeKind == FormData.ChangeType.Percent)
                            {
                                PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.Percentage_Click();
                            }

                            if (code.CodeKind == FormData.ChangeType.FixedAmount)
                            {
                                PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.FixAmount_Click();
                            }

                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.Amount.Type(code.Amount);
                            break;
                        case FormData.CustomFieldCodeType.AccessCode:
                            PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.Access_Click();
                            break;
                        default:
                            break;
                    }

                    if (code.Limit.HasValue)
                    {
                        PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.UseLimit.Type(code.Limit.Value);
                    }

                    PageObject.PageObjectProvider.Builder.EventDetails.FormPages.AgendaPage.CodeDefine.SaveAndClose_Click();
                    break;

                default:
                    break;
            }
        }
        public CodeRow(CustomFieldCode code)
        {
            this.Code = new Clickable(string.Format("//table[@id='tblCodes']//*[contains(text(),'{0}')]", code.CodeString), LocateBy.XPath);

            string OnClickAttributeOfCode = this.Code.GetAttribute("onclick");

            string tmp = OnClickAttributeOfCode.Split(new string[] { "'" }, StringSplitOptions.RemoveEmptyEntries)[1];

            this.CodeId = Convert.ToInt32(tmp);
        }
        public void RegistrationEventFeeDCPercent()
        {
            Event eventWithFeeDCDollar = new Event("RI-SingleRegistrationEventFeeDCPercent");
            RegType regType1 = new RegType("First");
            RegType regType2 = new RegType("Second");
            regType2.Price = 50;
            CustomFieldCode dc = new CustomFieldCode("CodeName");
            dc.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            dc.CodeDirection = FormData.ChangePriceDirection.Decrease;
            dc.Amount = 10;
            dc.CodeKind = FormData.ChangeType.FixedAmount;
            regType2.AllCustomCodes.Add(dc);
            eventWithFeeDCDollar.StartPage.RegTypes.Add(regType1);
            eventWithFeeDCDollar.StartPage.RegTypes.Add(regType2);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, eventWithFeeDCDollar);

            Registrant registrant = new Registrant(eventWithFeeDCDollar);
            registrant.EventFee_Response = new EventFeeResponse(eventWithFeeDCDollar.StartPage.RegTypes[1]);

            KeywordProvider.RegistrationCreation.Checkin(registrant);

            AssertHelper.VerifyOnPage(FormData.RegisterPage.PersonalInfo, true);
        }
        public void RegistrationEventFeeDCDollar()
        {
            Event eventWithFeeDCDollar = new Event("RI-SingleRegistrationEventFeeDCDollar");
            RegType regType1 = new RegType("First");
            RegType regType2 = new RegType("Second");
            regType2.Price = 50;
            CustomFieldCode dc = new CustomFieldCode("CodeName");
            dc.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            dc.CodeDirection = FormData.ChangePriceDirection.Decrease;
            dc.Amount = 10;
            dc.CodeKind = FormData.ChangeType.Percent;
            regType2.AllCustomCodes.Add(dc);
            eventWithFeeDCDollar.StartPage.RegTypes.Add(regType1);
            eventWithFeeDCDollar.StartPage.RegTypes.Add(regType2);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, eventWithFeeDCDollar);

            Registrant registrant = new Registrant(eventWithFeeDCDollar);
            registrant.EventFee_Response = new EventFeeResponse(eventWithFeeDCDollar.StartPage.RegTypes[1]);

            Registrant reg = new Registrant(eventWithFeeDCDollar, string.Format("test{0}@test.com", System.DateTime.Now.Ticks.ToString()));

            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.OpenUrl(reg);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EmailAddress.Type(reg.Email);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(eventWithFeeDCDollar.StartPage.RegTypes[1]);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EventFeeDiscountCode.Type("abc");
            PageObject.PageObjectProvider.Register.RegistationSite.Continue_Click();

            Assert.True(KeywordProvider.RegisterDefault.HasErrorMessage(Messages.RegisterError.InvalidCode));

            KeywordProvider.RegistrationCreation.Checkin(registrant);

            AssertHelper.VerifyOnPage(FormData.RegisterPage.PersonalInfo, true);
        }
        public Registrant RegistrationEventFeeCodeRequired(FormData.CustomFieldCodeType type)
        {
            Event eventFeeDCRequired = new Event(string.Format("RI-SingleRegistrationEventFee{0}Required", type.ToString()));
            RegType regType1 = new RegType("First");
            RegType regType2 = new RegType("Second");
            regType2.Price = 50;
            CustomFieldCode dc = new CustomFieldCode("CodeName");
            dc.CodeType = type;
            dc.CodeDirection = FormData.ChangePriceDirection.Decrease;
            dc.Amount = 10;
            dc.Limit = 1;
            dc.CodeKind = FormData.ChangeType.FixedAmount;
            regType2.AllCustomCodes.Add(dc);
            regType2.RequireDC = true;
            PaymentMethod paymentMethod = new PaymentMethod(FormData.PaymentMethod.Check);
            eventFeeDCRequired.StartPage.RegTypes.Add(regType1);
            eventFeeDCRequired.StartPage.RegTypes.Add(regType2);
            eventFeeDCRequired.CheckoutPage.PaymentMethods.Add(paymentMethod);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, eventFeeDCRequired);

            Registrant registrant = new Registrant(eventFeeDCRequired);
            registrant.EventFee_Response = new EventFeeResponse(eventFeeDCRequired.StartPage.RegTypes[1]);
            registrant.EventFee_Response.Code = dc;
            registrant.Payment_Method = paymentMethod;

            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.OpenUrl(registrant);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(registrant.EventFee_Response.RegType);

            Assert.True(PageObject.PageObjectProvider.Register.RegistationSite.Checkin.DiscountCodeRequired.IsPresent);

            KeywordProvider.RegistrationCreation.CreateRegistration(registrant);

            return registrant;
        }
        public void RegTypeWithFee()
        {
            Event evt = new Event("RI-RegTypeWithFee");

            RegType regType1 = new RegType("EarlyRegistrantsLateDate");
            EarlyPrice earlyPrice1 = new EarlyPrice();
            earlyPrice1.earlyPrice = 40;
            earlyPrice1.EarlyPriceType = FormData.EarlyPriceType.Registrants;
            earlyPrice1.FirstNRegistrants = 1;
            LatePrice latePrice1 = new LatePrice();
            latePrice1.latePrice = 60;
            latePrice1.LatePriceDate = DateTime.Today.AddDays(2);
            latePrice1.LatePriceTime = DateTime.Now;
            regType1.Price = 50;
            regType1.EarlyPrice = earlyPrice1;
            regType1.LatePrice = latePrice1;

            RegType regType2 = new RegType("EarlyLateFeeDCDollar");
            EarlyPrice earlyPrice2 = new EarlyPrice();
            earlyPrice2.earlyPrice = 40;
            earlyPrice2.EarlyPriceType = FormData.EarlyPriceType.DateAndTime;
            earlyPrice2.EarlyPriceDate = DateTime.Today.AddDays(-2);
            earlyPrice2.EarlyPriceTime = DateTime.Now;
            LatePrice latePrice2 = new LatePrice();
            latePrice2.latePrice = 60;
            latePrice2.LatePriceDate = DateTime.Today.AddDays(2);
            latePrice2.LatePriceTime = DateTime.Now;
            CustomFieldCode discountCode2 = new CustomFieldCode("code2");
            discountCode2.Amount = 5;
            discountCode2.CodeDirection = FormData.ChangePriceDirection.Decrease;
            discountCode2.CodeKind = FormData.ChangeType.FixedAmount;
            discountCode2.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            regType2.Price = 50;
            regType2.EarlyPrice = earlyPrice2;
            regType2.LatePrice = latePrice2;
            regType2.AllCustomCodes.Add(discountCode2);

            RegType regType3 = new RegType("EarlyLateFeeDCPercent");
            EarlyPrice earlyPrice3 = new EarlyPrice();
            earlyPrice3.earlyPrice = 40;
            earlyPrice3.EarlyPriceType = FormData.EarlyPriceType.DateAndTime;
            earlyPrice3.EarlyPriceDate = DateTime.Today.AddDays(-2);
            earlyPrice3.EarlyPriceTime = DateTime.Now;
            LatePrice latePrice3 = new LatePrice();
            latePrice3.latePrice = 60;
            latePrice3.LatePriceDate = DateTime.Today.AddDays(2);
            latePrice3.LatePriceTime = DateTime.Now;
            CustomFieldCode discountCode3 = new CustomFieldCode("code3");
            discountCode3.Amount = 10;
            discountCode3.CodeDirection = FormData.ChangePriceDirection.Decrease;
            discountCode3.CodeKind = FormData.ChangeType.Percent;
            discountCode3.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            regType3.Price = 50;
            regType3.EarlyPrice = earlyPrice3;
            regType3.LatePrice = latePrice3;
            regType3.AllCustomCodes.Add(discountCode3);

            RegType regType4 = new RegType("EarlyLateFeeDCPositiveDollar");
            EarlyPrice earlyPrice4 = new EarlyPrice();
            earlyPrice4.earlyPrice = 40;
            earlyPrice4.EarlyPriceType = FormData.EarlyPriceType.DateAndTime;
            earlyPrice4.EarlyPriceDate = DateTime.Today.AddDays(-2);
            earlyPrice4.EarlyPriceTime = DateTime.Now;
            LatePrice latePrice4 = new LatePrice();
            latePrice4.latePrice = 60;
            latePrice4.LatePriceDate = DateTime.Today.AddDays(2);
            latePrice4.LatePriceTime = DateTime.Now;
            CustomFieldCode discountCode4 = new CustomFieldCode("code4");
            discountCode4.Amount = -5;
            discountCode4.CodeDirection = FormData.ChangePriceDirection.Decrease;
            discountCode4.CodeKind = FormData.ChangeType.FixedAmount;
            discountCode4.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            regType4.Price = 50;
            regType4.EarlyPrice = earlyPrice4;
            regType4.LatePrice = latePrice4;
            regType4.AllCustomCodes.Add(discountCode4);

            RegType regType5 = new RegType("EarlyLateFeeDCRequired");
            EarlyPrice earlyPrice5 = new EarlyPrice();
            earlyPrice5.earlyPrice = 40;
            earlyPrice5.EarlyPriceType = FormData.EarlyPriceType.DateAndTime;
            earlyPrice5.EarlyPriceDate = DateTime.Today.AddDays(-2);
            earlyPrice5.EarlyPriceTime = DateTime.Now;
            LatePrice latePrice5 = new LatePrice();
            latePrice5.latePrice = 60;
            latePrice5.LatePriceDate = DateTime.Today.AddDays(2);
            latePrice5.LatePriceTime = DateTime.Now;
            CustomFieldCode discountCode5 = new CustomFieldCode("code5");
            discountCode5.Amount = 5;
            discountCode5.CodeDirection = FormData.ChangePriceDirection.Decrease;
            discountCode5.CodeKind = FormData.ChangeType.FixedAmount;
            discountCode5.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            regType5.Price = 50;
            regType5.EarlyPrice = earlyPrice5;
            regType5.LatePrice = latePrice5;
            regType5.AllCustomCodes.Add(discountCode5);
            regType5.RequireDC = true;

            RegType regType6 = new RegType("EarlyLateFeeAC");
            EarlyPrice earlyPrice6 = new EarlyPrice();
            earlyPrice6.earlyPrice = 40;
            earlyPrice6.EarlyPriceType = FormData.EarlyPriceType.DateAndTime;
            earlyPrice6.EarlyPriceDate = DateTime.Today.AddDays(-2);
            earlyPrice6.EarlyPriceTime = DateTime.Now;
            LatePrice latePrice6 = new LatePrice();
            latePrice6.latePrice = 60;
            latePrice6.LatePriceDate = DateTime.Today.AddDays(2);
            latePrice6.LatePriceTime = DateTime.Now;
            CustomFieldCode discountCode6 = new CustomFieldCode("code6");
            discountCode6.CodeType = FormData.CustomFieldCodeType.AccessCode;
            regType6.Price = 50;
            regType6.EarlyPrice = earlyPrice6;
            regType6.LatePrice = latePrice6;
            regType6.AllCustomCodes.Add(discountCode6);

            EarlyPrice earlyPrice7 = new EarlyPrice();
            earlyPrice7.earlyPrice = 40;
            earlyPrice7.EarlyPriceType = FormData.EarlyPriceType.DateAndTime;
            earlyPrice7.EarlyPriceDate = DateTime.Today.AddDays(-2);
            earlyPrice7.EarlyPriceTime = DateTime.Now;
            LatePrice latePrice7 = new LatePrice();
            latePrice7.latePrice = 60;
            latePrice7.LatePriceDate = DateTime.Today.AddDays(2);
            latePrice7.LatePriceTime = DateTime.Now;
            CustomFieldCode discountCode7 = new CustomFieldCode("code7");
            discountCode7.Amount = 5;
            discountCode7.CodeDirection = FormData.ChangePriceDirection.Decrease;
            discountCode7.CodeKind = FormData.ChangeType.FixedAmount;
            discountCode7.CodeType = FormData.CustomFieldCodeType.DiscountCode;

            PaymentMethod paymentMethod = new PaymentMethod(FormData.PaymentMethod.Check);

            evt.StartPage.RegTypes.Add(regType1);
            evt.StartPage.RegTypes.Add(regType2);
            evt.StartPage.RegTypes.Add(regType3);
            evt.StartPage.RegTypes.Add(regType4);
            evt.StartPage.RegTypes.Add(regType5);
            evt.StartPage.RegTypes.Add(regType6);
            evt.CheckoutPage.PaymentMethods.Add(paymentMethod);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, evt);

            Registrant reg1 = new Registrant(evt);
            reg1.EventFee_Response = new EventFeeResponse(regType1);
            reg1.Payment_Method = paymentMethod;

            KeywordProvider.RegistrationCreation.CreateRegistration(reg1);
            Assert.True(reg1.EventFee_Response.RegType.EarlyPrice.earlyPrice.Equals(KeywordProvider.RegisterDefault.GetTotal(DataCollection.FormData.RegisterPage.Confirmation)));

            Registrant reg2 = new Registrant(evt);
            reg2.EventFee_Response = new EventFeeResponse(regType1);
            reg2.Payment_Method = paymentMethod;

            KeywordProvider.RegistrationCreation.CreateRegistration(reg2);
            Assert.True(reg2.EventFee_Response.RegType.Price.Value.Equals(KeywordProvider.RegisterDefault.GetTotal(DataCollection.FormData.RegisterPage.Confirmation)));

            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.OpenUrl(reg2);
            PageObject.PageObjectProvider.Register.RegistationSite.Login.StartNewRegistration_Click();
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(regType2);
            Assert.True(PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EventFeeDiscountCode.IsPresent);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(regType3);
            Assert.True(PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EventFeeDiscountCode.IsPresent);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(regType4);
            Assert.True(PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EventFeeDiscountCode.IsPresent);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(regType5);
            Assert.True(PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EventFeeDiscountCode.IsPresent);
            Assert.True(PageObject.PageObjectProvider.Register.RegistationSite.Checkin.DiscountCodeRequired.IsPresent);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(regType6);
            Assert.True(PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EventFeeDiscountCode.IsPresent);
        }
        public void RecalculateTotal()
        {
            Event evt = new Event("AgendaRecalculate");
            evt.AgendaPage = new AgendaPage();
            AgendaItem_CheckBox agenda1 = new AgendaItem_CheckBox("agenda1");
            agenda1.Price = 50;
            AgendaItem_CheckBox agenda2 = new AgendaItem_CheckBox("agenda2");
            agenda2.Price = 60;
            CustomFieldCode discount = new CustomFieldCode("discount");
            discount.Amount = 10;
            discount.CodeDirection = FormData.ChangePriceDirection.Decrease;
            discount.CodeKind = FormData.ChangeType.Percent;
            discount.CodeType = FormData.CustomFieldCodeType.DiscountCode;
            agenda2.DiscountCodes.Add(discount);
            evt.AgendaPage.AgendaItems.Add(agenda1);
            evt.AgendaPage.AgendaItems.Add(agenda2);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, evt, false);

            Registrant reg = new Registrant(evt);

            KeywordProvider.RegistrationCreation.Checkin(reg);
            KeywordProvider.RegistrationCreation.PersonalInfo(reg);
            PageObject.Register.AgendaRow row1 = new PageObject.Register.AgendaRow(agenda1);
            PageObject.Register.AgendaRow row2 = new PageObject.Register.AgendaRow(agenda2);
            ((WebElements.CheckBox)(row1.AgendaType)).Set(true);
            PageObject.PageObjectProvider.Register.RegistationSite.Agenda.RecalculateTotal_Click();
            Assert.AreEqual(agenda1.Price, KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Agenda));
            ((WebElements.CheckBox)(row2.AgendaType)).Set(true);
            PageObject.PageObjectProvider.Register.RegistationSite.Agenda.RecalculateTotal_Click();
            Assert.AreEqual(agenda1.Price + agenda2.Price, KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Agenda));
            ((WebElements.CheckBox)(row1.AgendaType)).Set(false);
            PageObject.PageObjectProvider.Register.RegistationSite.Agenda.RecalculateTotal_Click();
            Assert.AreEqual(agenda2.Price, KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Agenda));
            row2.DiscountCodeInput.Type(discount.CodeString);
            PageObject.PageObjectProvider.Register.RegistationSite.Agenda.RecalculateTotal_Click();
            Assert.AreEqual(54, KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Agenda));
        }