public void SaveRepoBasedAggregateWithChilds() { var id = new ViewingId(Guid.NewGuid().ToString(), fixture.dateOfViewing, fixture.cinemaId); using (var session = fixture.ViewingFunctionalRepo.BeginSessionFor(id).Result) { session.AddEvent(RepoBasedViewing.CreateViewing(id.CinemaId, id.MovieName, id.ShowingDate, Capacity)); session.SaveChanges().Wait(); } }
public void Setup() { fixture = new AggregateFixture(Guid.NewGuid().ToString()); viewingId = new ViewingId(Guid.NewGuid().ToString(), fixture.dateOfViewing, fixture.cinemaId); fixture.AddViewingAndSeatCreationEvents(viewingId, Capacity); for (ushort u = 0; u < Capacity; u++) { fixture.AddSeatReservationEvent(viewingId, u); } }
public void AddSeatReservationEvent(ViewingId viewingId, ushort seatNumber) { var seatReserved = new SeatReservedEvent(viewingId, new SeatId(seatNumber)); using (var session = ViewingFunctionalRepo.BeginSessionFor(viewingId).Result) { session.AddEvent(seatReserved); session.SaveChanges().Wait(); } }
private void AddSeatCreatedEvent(ViewingId viewingId, ushort seatNumber) { var seatCreated = new SeatInViewingInitialized(new SeatId(seatNumber)); using (var session = ViewingFunctionalRepo.BeginSessionFor(viewingId).Result) { session.AddEvent(seatCreated); session.SaveChanges().Wait(); } }
public void AddViewingAndSeatCreationEvents(ViewingId viewingId, int capacity) { var viewingCreatedEvent = new ViewingCreatedEvent(viewingId, capacity); using (var session = ViewingFunctionalRepo.BeginSessionFor(viewingCreatedEvent.ViewingId).Result) { session.AddEvent(viewingCreatedEvent); session.SaveChanges().Wait(); } for (ushort i = 0; i < capacity; i++) { AddSeatCreatedEvent(viewingCreatedEvent.ViewingId, i); } }
public void Setup() { fixture = new AggregateFixture(Guid.NewGuid().ToString()); viewingId = new ViewingId(Guid.NewGuid().ToString(), fixture.dateOfViewing, fixture.cinemaId); fixture.AddViewingAndSeatCreationEvents(viewingId, Capacity); }
public SeatReservedEvent(ViewingId viewingId, SeatId idOfSeatToReserve) : base(Guid.NewGuid()) { ViewingId = viewingId; IdOfSeatToReserve = idOfSeatToReserve; }
public ViewingCreatedEvent(ViewingId viewingAggregateViewingId, int numberOfSeats) : base(Guid.NewGuid()) { ViewingId = viewingAggregateViewingId; Seats = numberOfSeats; }