/// <summary> /// Creates new leg instance. /// </summary> /// <param name="voyage">Voyage</param> /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param> /// <param name="loadDate">Date and time when cargo is supposed to be loaded</param> /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param> /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param> public Leg(Voyage voyage, Location loadLocation, DateTime loadDate, Location unloadLocation, DateTime unloadDate) { _loadLocation = loadLocation; _voyage = voyage; _unloadDate = unloadDate; _unloadLocation = unloadLocation; _loadDate = loadDate; }
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), null)); } using (Scope(true)) { IList<Cargo> cargos = Session.CreateQuery("from DDDSample.DomainModel.Operations.Cargo.Cargo c").List<Cargo>(); Assert.AreEqual(1, cargos.Count); } }
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, Location location, DateTime registrationDate, DateTime completionDate) { HandlingEvent @event = new HandlingEvent(eventType, location, registrationDate, completionDate,this); _events.Add(@event); DomainEvents.Raise(new CargoWasHandledEvent(@event)); }