public RouteSpecification(Location.Location origin, Location.Location destination, DateTime arrivalDeadline) { if (origin == null) { throw new ArgumentNullException("origin"); } if (destination == null) { throw new ArgumentNullException("destination"); } if (origin == destination) { throw new ArgumentException("Origin and destination can't be the same."); } _origin = origin; _arrivalDeadline = arrivalDeadline; _destination = destination; }
public void Store_EmptyStore_CargoSaved() { CargoRepository repository = new CargoRepository(SessionFactory); using (Scope(true)) { Location krakow = new Location(new UnLocode("PLKRK"), "Krakow"); Session.Save(krakow); Location warszawa = new Location(new UnLocode("PLWAW"), "Warszawa"); Session.Save(warszawa); repository.Store(new Cargo(new TrackingId("xxx"),new RouteSpecification(krakow, warszawa, DateTime.Now) )); } using (Scope(true)) { IList<Cargo> cargos = Session.CreateQuery("from DDDSample.Domain.Cargo.Cargo c").List<Cargo>(); Assert.AreEqual(1, cargos.Count); } }
private static HandlingEvent Event(HandlingEventType eventType, Location.Location location) { return new HandlingEvent(eventType, location, DateTime.Now, DateTime.Now, null); }
public void In(Location.Location location) { if (_expected) { Assert.IsTrue(_itinerary.IsExpected(Event(_eventType, location))); } else { Assert.IsFalse(_itinerary.IsExpected(Event(_eventType, location))); } }