public CarrierMovement( CarrierMovementId id, LocationId departureLocationId, LocationId arrivalLocationId, DateTimeOffset departureTime, DateTimeOffset arrivalTime) : base(id) { if (departureLocationId == null) { throw new ArgumentNullException(nameof(departureLocationId)); } if (arrivalLocationId == null) { throw new ArgumentNullException(nameof(arrivalLocationId)); } if (departureTime == default(DateTimeOffset)) { throw new ArgumentOutOfRangeException(nameof(departureTime)); } if (arrivalTime == default(DateTimeOffset)) { throw new ArgumentOutOfRangeException(nameof(arrivalTime)); } if (departureTime.IsAfter(arrivalTime)) { throw new ArgumentException("Arrival time must be after departure"); } DepartureLocationId = departureLocationId; ArrivalLocationId = arrivalLocationId; DepartureTime = departureTime; ArrivalTime = arrivalTime; }
public Route( LocationId originLocationId, LocationId destinationLocationId, DateTimeOffset departureTime, DateTimeOffset arrivalDeadline) { if (originLocationId == null) throw new ArgumentNullException(nameof(originLocationId)); if (destinationLocationId == null) throw new ArgumentNullException(nameof(destinationLocationId)); if (arrivalDeadline == default(DateTimeOffset)) throw new ArgumentOutOfRangeException(nameof(arrivalDeadline)); if (departureTime == default(DateTimeOffset)) throw new ArgumentOutOfRangeException(nameof(departureTime)); if (originLocationId == destinationLocationId) throw new ArgumentException("Origin and destination cannot be the same"); if (departureTime.IsAfter(arrivalDeadline)) throw new ArgumentException("Departure must be before arrival"); OriginLocationId = originLocationId; DestinationLocationId = destinationLocationId; DepartureTime = departureTime; ArrivalDeadline = arrivalDeadline; }
public Route( LocationId originLocationId, LocationId destinationLocationId, DateTimeOffset departureTime, DateTimeOffset arrivalDeadline) { if (originLocationId == null) { throw new ArgumentNullException(nameof(originLocationId)); } if (destinationLocationId == null) { throw new ArgumentNullException(nameof(destinationLocationId)); } if (arrivalDeadline == default(DateTimeOffset)) { throw new ArgumentOutOfRangeException(nameof(arrivalDeadline)); } if (departureTime == default(DateTimeOffset)) { throw new ArgumentOutOfRangeException(nameof(departureTime)); } if (originLocationId == destinationLocationId) { throw new ArgumentException("Origin and destination cannot be the same"); } if (departureTime.IsAfter(arrivalDeadline)) { throw new ArgumentException("Departure must be before arrival"); } OriginLocationId = originLocationId; DestinationLocationId = destinationLocationId; DepartureTime = departureTime; ArrivalDeadline = arrivalDeadline; }