private void Process(Pnr pnr) { this.logger.Info(NLog.LogLevel.Info); Console.WriteLine($" Processing pnr {pnr.Locator}"); Thread.Sleep(1000); this.Sender.Tell(new CompletedResponse()); }
IEnumerator GetPnr(string name, string reference) { System.DateTime departure = new System.DateTime(2050, 9, 25, 17, 55, 0); WWWForm form = new WWWForm(); Debug.Log("dep " + departure.ToString()); form.AddField("bookingReference", reference); form.AddField("bookingLastName", name); using (UnityWebRequest www = UnityWebRequest.Post("https://apigw.singaporeair.com/appchallenge/api/pax/pnr", form)) { www.SetRequestHeader("apikey", "aghk73f4x5haxeby7z24d2rc"); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { // text.text = www.error.ToString(); } else { Pnr pnr = JsonUtility.FromJson <Pnr>(www.downloadHandler.text.ToString()); departure = Convert.ToDateTime(pnr.responseBody.flights[0].flightSegment[0].estimatedDepartureTime).Add(new System.TimeSpan(0, -30, 0)); System.DateTime now = new System.DateTime(2018, 9, 25, 17, 59, 45); while (System.DateTime.Compare(now, departure) < 0) { now = now.AddSeconds(1); yield return(new WaitForSeconds(1)); } gameController.ShowWarning(); } } }
private void Process(Pnr pnr) { Console.WriteLine($" Processing pnr {pnr.Locator}"); Thread.Sleep(1000); this.Sender.Tell(new CompletedResponse()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (AgentNumericCode != null) { hashCode = hashCode * 59 + AgentNumericCode.GetHashCode(); } if (Code != null) { hashCode = hashCode * 59 + Code.GetHashCode(); } if (FlightDate != null) { hashCode = hashCode * 59 + FlightDate.GetHashCode(); } if (FlightLegs != null) { hashCode = hashCode * 59 + FlightLegs.GetHashCode(); } if (InvoiceNumber != null) { hashCode = hashCode * 59 + InvoiceNumber.GetHashCode(); } if (IsETicket != null) { hashCode = hashCode * 59 + IsETicket.GetHashCode(); } if (IsRegisteredCustomer != null) { hashCode = hashCode * 59 + IsRegisteredCustomer.GetHashCode(); } if (IsRestrictedTicket != null) { hashCode = hashCode * 59 + IsRestrictedTicket.GetHashCode(); } if (IsThirdParty != null) { hashCode = hashCode * 59 + IsThirdParty.GetHashCode(); } if (IssueDate != null) { hashCode = hashCode * 59 + IssueDate.GetHashCode(); } if (MerchantCustomerId != null) { hashCode = hashCode * 59 + MerchantCustomerId.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (PassengerName != null) { hashCode = hashCode * 59 + PassengerName.GetHashCode(); } if (Passengers != null) { hashCode = hashCode * 59 + Passengers.GetHashCode(); } if (PlaceOfIssue != null) { hashCode = hashCode * 59 + PlaceOfIssue.GetHashCode(); } if (Pnr != null) { hashCode = hashCode * 59 + Pnr.GetHashCode(); } if (PointOfSale != null) { hashCode = hashCode * 59 + PointOfSale.GetHashCode(); } if (PosCityCode != null) { hashCode = hashCode * 59 + PosCityCode.GetHashCode(); } if (TicketDeliveryMethod != null) { hashCode = hashCode * 59 + TicketDeliveryMethod.GetHashCode(); } if (TicketNumber != null) { hashCode = hashCode * 59 + TicketNumber.GetHashCode(); } if (TotalFare != null) { hashCode = hashCode * 59 + TotalFare.GetHashCode(); } if (TotalFee != null) { hashCode = hashCode * 59 + TotalFee.GetHashCode(); } if (TotalTaxes != null) { hashCode = hashCode * 59 + TotalTaxes.GetHashCode(); } if (TravelAgencyName != null) { hashCode = hashCode * 59 + TravelAgencyName.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if AirlineData instances are equal /// </summary> /// <param name="other">Instance of AirlineData to be compared</param> /// <returns>Boolean</returns> public bool Equals(AirlineData other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AgentNumericCode == other.AgentNumericCode || AgentNumericCode != null && AgentNumericCode.Equals(other.AgentNumericCode) ) && ( Code == other.Code || Code != null && Code.Equals(other.Code) ) && ( FlightDate == other.FlightDate || FlightDate != null && FlightDate.Equals(other.FlightDate) ) && ( FlightLegs == other.FlightLegs || FlightLegs != null && FlightLegs.SequenceEqual(other.FlightLegs) ) && ( InvoiceNumber == other.InvoiceNumber || InvoiceNumber != null && InvoiceNumber.Equals(other.InvoiceNumber) ) && ( IsETicket == other.IsETicket || IsETicket != null && IsETicket.Equals(other.IsETicket) ) && ( IsRegisteredCustomer == other.IsRegisteredCustomer || IsRegisteredCustomer != null && IsRegisteredCustomer.Equals(other.IsRegisteredCustomer) ) && ( IsRestrictedTicket == other.IsRestrictedTicket || IsRestrictedTicket != null && IsRestrictedTicket.Equals(other.IsRestrictedTicket) ) && ( IsThirdParty == other.IsThirdParty || IsThirdParty != null && IsThirdParty.Equals(other.IsThirdParty) ) && ( IssueDate == other.IssueDate || IssueDate != null && IssueDate.Equals(other.IssueDate) ) && ( MerchantCustomerId == other.MerchantCustomerId || MerchantCustomerId != null && MerchantCustomerId.Equals(other.MerchantCustomerId) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( PassengerName == other.PassengerName || PassengerName != null && PassengerName.Equals(other.PassengerName) ) && ( Passengers == other.Passengers || Passengers != null && Passengers.SequenceEqual(other.Passengers) ) && ( PlaceOfIssue == other.PlaceOfIssue || PlaceOfIssue != null && PlaceOfIssue.Equals(other.PlaceOfIssue) ) && ( Pnr == other.Pnr || Pnr != null && Pnr.Equals(other.Pnr) ) && ( PointOfSale == other.PointOfSale || PointOfSale != null && PointOfSale.Equals(other.PointOfSale) ) && ( PosCityCode == other.PosCityCode || PosCityCode != null && PosCityCode.Equals(other.PosCityCode) ) && ( TicketDeliveryMethod == other.TicketDeliveryMethod || TicketDeliveryMethod != null && TicketDeliveryMethod.Equals(other.TicketDeliveryMethod) ) && ( TicketNumber == other.TicketNumber || TicketNumber != null && TicketNumber.Equals(other.TicketNumber) ) && ( TotalFare == other.TotalFare || TotalFare != null && TotalFare.Equals(other.TotalFare) ) && ( TotalFee == other.TotalFee || TotalFee != null && TotalFee.Equals(other.TotalFee) ) && ( TotalTaxes == other.TotalTaxes || TotalTaxes != null && TotalTaxes.Equals(other.TotalTaxes) ) && ( TravelAgencyName == other.TravelAgencyName || TravelAgencyName != null && TravelAgencyName.Equals(other.TravelAgencyName) )); }
public void Pnr_ParsesDate() { var pnr = new Pnr("06018209495"); Assert.That(pnr.Date, Is.EqualTo(new DateTime(1982, 1, 6))); }
public void Pnr_IsInvalid_ForNonNumericString() { var pnr = new Pnr("06018Æ09495"); Assert.That(() => pnr.Validate(), Throws.Exception); }
public void Pnr_IsInvalid_ForInvalidLength() { var pnr = new Pnr("0601820949"); Assert.That(() => pnr.Validate(), Throws.Exception); }
public void Pnr_IsValid_ForValidPnr() { var pnr = new Pnr("06018209495"); Assert.That(() => pnr.Validate(), Throws.Nothing); }