Ejemplo n.º 1
0
        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);
     }
 }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
 public void Setup()
 {
     fixture   = new AggregateFixture(Guid.NewGuid().ToString());
     viewingId = new ViewingId(Guid.NewGuid().ToString(), fixture.dateOfViewing, fixture.cinemaId);
     fixture.AddViewingAndSeatCreationEvents(viewingId, Capacity);
 }
Ejemplo n.º 7
0
 public SeatReservedEvent(ViewingId viewingId, SeatId idOfSeatToReserve)
     : base(Guid.NewGuid())
 {
     ViewingId         = viewingId;
     IdOfSeatToReserve = idOfSeatToReserve;
 }
Ejemplo n.º 8
0
 public ViewingCreatedEvent(ViewingId viewingAggregateViewingId, int numberOfSeats)
     : base(Guid.NewGuid())
 {
     ViewingId = viewingAggregateViewingId;
     Seats     = numberOfSeats;
 }