public void Itinerary_ShouldNotBeEqual_WithOtherItineraryWithDifferentLegs() { var option = new PricingOption { Price = 123M, QuoteAge = 1, AgentIds = { 12 } }; var first = new Itinerary { OutboundLegId = "AAA", InboundLegId = "BBB", PricingOptions = { option } }; var second = new Itinerary { OutboundLegId = "BBB", InboundLegId = "CCC", PricingOptions = { option } }; var comparer = new ShallowEqualityComparer <Itinerary>(); Assert.IsFalse(comparer.Equals(first, second)); }
public void Itinerary_ShouldNotBeEqual_IfPricingOptionWasAddedAndComparingDeep() { var option1 = new PricingOption { Price = 123M, QuoteAge = 1, AgentIds = { 12 } }; var option2 = new PricingOption { Price = 456M, QuoteAge = 1, AgentIds = { 13 } }; var first = new Itinerary { OutboundLegId = "AAA", InboundLegId = "BBB", PricingOptions = { option1 } }; var second = new Itinerary { OutboundLegId = "AAA", InboundLegId = "BBB", PricingOptions = { option1, option2 } }; Assert.IsFalse(((IInterimEquatable <Itinerary>)first).DeepEquals(second)); }
public void Itinerary_ShouldBeEqual_IfPricingOptionWasAddedAndComparingShallow() { var option1 = new PricingOption { Price = 123M, QuoteAge = 1, AgentIds = { 12 } }; var option2 = new PricingOption { Price = 456M, QuoteAge = 1, AgentIds = { 13 } }; var first = new Itinerary { OutboundLegId = "AAA", InboundLegId = "BBB", PricingOptions = { option1 } }; var second = new Itinerary { OutboundLegId = "AAA", InboundLegId = "BBB", PricingOptions = { option1, option2 } }; var comparer = new ShallowEqualityComparer <Itinerary>(); Assert.IsTrue(comparer.Equals(first, second)); }
public override void Set(string name, string elementValue) { DateTime dtTemp; switch (name) { case "startDate": if (Types.DisplayFormats.HistoricalOrReferenceRequests.TryParseInput(elementValue, out dtTemp)) { this._dtStart = new HistoricRequestElementDate("startDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue)); } break; case "endDate": if (Types.DisplayFormats.HistoricalOrReferenceRequests.TryParseInput(elementValue, out dtTemp)) { this._dtEnd = new HistoricRequestElementDate("endDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue)); } break; case "periodicityAdjustment": switch (elementValue) { case "CALENDAR": this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar; break; case "FISCAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal; break; case "ACTUAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment. These are case-sensitive.", elementValue)); } this._periodicityAdjustmentElement = new HistoricRequestElementString("periodicityAdjustment", elementValue); break; case "periodicitySelection": switch (elementValue) { case "WEEKLY": this._periodicity = HistDataPeriodicity.weekly; break; case "MONTHLY": this._periodicity = HistDataPeriodicity.monthly; break; case "QUARTERLY": this._periodicity = HistDataPeriodicity.quarterly; break; case "SEMI_ANNUALLY": this._periodicity = HistDataPeriodicity.semi_annually; break; case "YEARLY": this._periodicity = HistDataPeriodicity.yearly; break; case "DAILY": this._periodicity = HistDataPeriodicity.daily; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection. These are case-sensitive.", elementValue)); } this._periodicityElement = new HistoricRequestElementString("periodicitySelection", elementValue); break; case "pricingOption": switch (elementValue) { case "PRICING_OPTION_YIELD": this._pricingOption = PricingOption.yield; break; case "PRICING_OPTION_PRICE": this._pricingOption = PricingOption.price; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption. These are case-sensitive.", elementValue)); } this._pricingOptionElement = new HistoricRequestElementString("pricingOption", elementValue); break; case "overrideOption": switch (elementValue) { case "OVERRIDE_OPTION_GPA": this._overrideOptions = OverrideOptions.averagePrice; break; case "OVERRIDE_OPTION_CLOSE": this._overrideOptions = OverrideOptions.closingPrice; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption. These are case-sensitive.", elementValue)); } this._overrideOptionsElement = new HistoricRequestElementString("overrideOption", elementValue); break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported. These are case-sensitive.", name)); } }
public override void Set(string name, string elementValue) { DateTime dtTemp; switch (name.ToLower()) { case "startdate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) this._dtStart = new RequestHistoricElementDate("startDate", dtTemp); else throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue)); break; case "enddate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) this._dtEnd = new RequestHistoricElementDate("endDate", dtTemp); else throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue)); break; case "periodicityadjustment": string pAdjUpper = elementValue.ToUpper(); switch (pAdjUpper) { case "CALENDAR": this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar; break; case "FISCAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal; break; case "ACTUAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment", elementValue)); } this._periodicityAdjustmentElement = new RequestHistoricElementString("periodicityAdjustment", pAdjUpper); break; case "periodicityselection": string pUpper = elementValue.ToUpper(); switch (pUpper) { case "WEEKLY": this._periodicity = HistDataPeriodicity.weekly; break; case "MONTHLY": this._periodicity = HistDataPeriodicity.monthly; break; case "QUARTERLY": this._periodicity = HistDataPeriodicity.quarterly; break; case "SEMI_ANNUALLY": this._periodicity = HistDataPeriodicity.semi_annually; break; case "YEARLY": this._periodicity = HistDataPeriodicity.yearly; break; case "DAILY": this._periodicity = HistDataPeriodicity.daily; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection", elementValue)); } this._periodicityElement = new RequestHistoricElementString("periodicitySelection", pUpper); break; case "pricingoption": string prUpper = elementValue.ToUpper(); switch (prUpper) { case "PRICING_OPTION_YIELD": this._pricingOption = PricingOption.yield; break; case "PRICING_OPTION_PRICE": this._pricingOption = PricingOption.price; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption", elementValue)); } this._pricingOptionElement = new RequestHistoricElementString("pricingOption", prUpper); break; case "overrideoption": string strOpt = elementValue.ToUpper(); switch (strOpt) { case "OVERRIDE_OPTION_GPA": this._overrideOptions = OverrideOptions.averagePrice; break; case "OVERRIDE_OPTION_CLOSE": this._overrideOptions = OverrideOptions.closingPrice; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption", elementValue)); } this._overrideOptionsElement = new RequestHistoricElementString("overrideOption", strOpt); break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported", name)); } }
public override void Set(string name, string elementValue) { DateTime dtTemp; switch (name.ToLower()) { case "startdate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) { this._dtStart = new RequestHistoricElementDate("startDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue)); } break; case "enddate": if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp)) { this._dtEnd = new RequestHistoricElementDate("endDate", dtTemp); } else { throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue)); } break; case "periodicityadjustment": string pAdjUpper = elementValue.ToUpper(); switch (pAdjUpper) { case "CALENDAR": this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar; break; case "FISCAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal; break; case "ACTUAL": this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment", elementValue)); } this._periodicityAdjustmentElement = new RequestHistoricElementString("periodicityAdjustment", pAdjUpper); break; case "periodicityselection": string pUpper = elementValue.ToUpper(); switch (pUpper) { case "WEEKLY": this._periodicity = HistDataPeriodicity.weekly; break; case "MONTHLY": this._periodicity = HistDataPeriodicity.monthly; break; case "QUARTERLY": this._periodicity = HistDataPeriodicity.quarterly; break; case "SEMI_ANNUALLY": this._periodicity = HistDataPeriodicity.semi_annually; break; case "YEARLY": this._periodicity = HistDataPeriodicity.yearly; break; case "DAILY": this._periodicity = HistDataPeriodicity.daily; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection", elementValue)); } this._periodicityElement = new RequestHistoricElementString("periodicitySelection", pUpper); break; case "pricingoption": string prUpper = elementValue.ToUpper(); switch (prUpper) { case "PRICING_OPTION_YIELD": this._pricingOption = PricingOption.yield; break; case "PRICING_OPTION_PRICE": this._pricingOption = PricingOption.price; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption", elementValue)); } this._pricingOptionElement = new RequestHistoricElementString("pricingOption", prUpper); break; case "overrideoption": string strOpt = elementValue.ToUpper(); switch (strOpt) { case "OVERRIDE_OPTION_GPA": this._overrideOptions = OverrideOptions.averagePrice; break; case "OVERRIDE_OPTION_CLOSE": this._overrideOptions = OverrideOptions.closingPrice; break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption", elementValue)); } this._overrideOptionsElement = new RequestHistoricElementString("overrideOption", strOpt); break; default: throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported", name)); } }
public void SetCheckboxCFItem(string cfName, bool check, string discountCode, PricingOption? pricingOption, CustomFieldStatus? customFieldStatus) { int checkboxId = this.GetCFItemID(cfName); this.SetCheckboxCFItem(checkboxId, check); this.TypeCFDiscountCode(checkboxId, discountCode); this.SetCFPricingSchedule(checkboxId, pricingOption); this.SelectCFStatus(checkboxId, customFieldStatus); }
public void SetCFPricingSchedule(int cfId, PricingOption? pricingOption) { if (pricingOption.HasValue) { string pricingOptionLocator = string.Format(PricingOptionLocatorFormat, (int)pricingOption.Value, cfId); UIUtil.DefaultProvider.WaitForDisplayAndClick(pricingOptionLocator, LocateBy.XPath); } }