public MainPage InputStationsAndSeacrh(Route route) { WaitElementId(10, "txtFrom"); DepartureStation.SendKeys(route.DepartureCity); WaitElementId(10, "txtTo"); ArrivalStation.SendKeys(route.ArrivalCity); return(this); }
/// <summary> /// Validates the departure and arrival station. /// </summary> private void ValidateDepartureAndArrivalStation() { if (string.IsNullOrEmpty(DepartureStation)) { throw new InvalidAvailabilityRequestException("No se ha especificado la cuidad de salida.") { ErrorCode = ErrorCode.NoDepartureStation }; } if (string.IsNullOrEmpty(ArrivalStation)) { throw new InvalidAvailabilityRequestException("No se ha especificado la cuidad de llegada.") { ErrorCode = ErrorCode.NoArrivalStation }; } if (!string.IsNullOrEmpty(DepartureStation) && DepartureStation.Length > 0 && DepartureStation.Length > 3) { throw new InvalidAvailabilityRequestException("La cuidad de destino no puede ser mayor a 3 caracteres.") { ErrorCode = ErrorCode.IncorrecDepartureStation }; } if (!string.IsNullOrEmpty(ArrivalStation) && ArrivalStation.Length > 0 && ArrivalStation.Length > 3) { throw new InvalidAvailabilityRequestException("La cuidad de llegada no puede ser mayor a 3 caracteres.") { ErrorCode = ErrorCode.IncorrectArrivalStation }; } if (!string.IsNullOrEmpty(ArrivalStation) && !string.IsNullOrEmpty(DepartureStation)) { if (ArrivalStation.Equals(DepartureStation)) { throw new InvalidAvailabilityRequestException("La cuidad destino y llegada no puede ser igual.") { ErrorCode = ErrorCode.SameDepartureAndArrivalStation }; } } }
/// <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 (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } hashCode = hashCode * 59 + Type.GetHashCode(); hashCode = hashCode * 59 + Mode.GetHashCode(); if (Directions != null) { hashCode = hashCode * 59 + Directions.GetHashCode(); } hashCode = hashCode * 59 + Distance.GetHashCode(); hashCode = hashCode * 59 + TravelTime.GetHashCode(); if (Coords != null) { hashCode = hashCode * 59 + Coords.GetHashCode(); } if (Direction != null) { hashCode = hashCode * 59 + Direction.GetHashCode(); } if (Road != null) { hashCode = hashCode * 59 + Road.GetHashCode(); } if (Turn != null) { hashCode = hashCode * 59 + Turn.GetHashCode(); } if (Line != null) { hashCode = hashCode * 59 + Line.GetHashCode(); } if (DepartureStation != null) { hashCode = hashCode * 59 + DepartureStation.GetHashCode(); } if (ArrivalStation != null) { hashCode = hashCode * 59 + ArrivalStation.GetHashCode(); } if (DepartsAt != null) { hashCode = hashCode * 59 + DepartsAt.GetHashCode(); } if (ArrivesAt != null) { hashCode = hashCode * 59 + ArrivesAt.GetHashCode(); } hashCode = hashCode * 59 + NumStops.GetHashCode(); return(hashCode); } }
/// <summary> /// Returns true if ResponseRoutePart instances are equal /// </summary> /// <param name="other">Instance of ResponseRoutePart to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseRoutePart other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Type == other.Type || Type.Equals(other.Type) ) && ( Mode == other.Mode || Mode.Equals(other.Mode) ) && ( Directions == other.Directions || Directions != null && Directions.Equals(other.Directions) ) && ( Distance == other.Distance || Distance.Equals(other.Distance) ) && ( TravelTime == other.TravelTime || TravelTime.Equals(other.TravelTime) ) && ( Coords == other.Coords || Coords != null && other.Coords != null && Coords.SequenceEqual(other.Coords) ) && ( Direction == other.Direction || Direction != null && Direction.Equals(other.Direction) ) && ( Road == other.Road || Road != null && Road.Equals(other.Road) ) && ( Turn == other.Turn || Turn != null && Turn.Equals(other.Turn) ) && ( Line == other.Line || Line != null && Line.Equals(other.Line) ) && ( DepartureStation == other.DepartureStation || DepartureStation != null && DepartureStation.Equals(other.DepartureStation) ) && ( ArrivalStation == other.ArrivalStation || ArrivalStation != null && ArrivalStation.Equals(other.ArrivalStation) ) && ( DepartsAt == other.DepartsAt || DepartsAt != null && DepartsAt.Equals(other.DepartsAt) ) && ( ArrivesAt == other.ArrivesAt || ArrivesAt != null && ArrivesAt.Equals(other.ArrivesAt) ) && ( NumStops == other.NumStops || NumStops.Equals(other.NumStops) )); }