Esempio n. 1
0
    public static Reservation HasTentativeReservationCreatedEventWith(
        this Reservation reservation,
        Guid id,
        string number,
        Guid seatId)
    {
        var @event = reservation.PublishedEvent <TentativeReservationCreated>();

        @event.Should().NotBeNull();
        @event.Should().BeOfType <TentativeReservationCreated>();
        @event !.ReservationId.Should().Be(id);
        @event.Number.Should().Be(number);
        @event.SeatId.Should().Be(seatId);

        return(reservation);
    }
Esempio n. 2
0
        public void ForTentativeReservation_ShouldSucceed()
        {
            // Given
            var reservation = ReservationBuilder
                              .Create()
                              .Tentative()
                              .Build();

            // When
            reservation.Cancel();

            // Then
            reservation.Status.Should().Be(ReservationStatus.Cancelled);
            reservation.Version.Should().Be(2);

            var @event = reservation.PublishedEvent <ReservationCancelled>();

            @event.Should().NotBeNull();
            @event.Should().BeOfType <ReservationCancelled>();
            @event !.ReservationId.Should().Be(reservation.Id);
        }
        public void ForValidParams_UpdatesSeatId()
        {
            // Given
            var reservation = ReservationBuilder
                              .Create()
                              .Tentative()
                              .Build();

            var newSeatId = Guid.NewGuid();

            // When
            reservation.ChangeSeat(newSeatId);

            // Then
            reservation.SeatId.Should().Be(newSeatId);
            reservation.Version.Should().Be(2);

            var @event = reservation.PublishedEvent <ReservationSeatChanged>();

            @event.Should().NotBeNull();
            @event.Should().BeOfType <ReservationSeatChanged>();
            @event !.ReservationId.Should().Be(reservation.Id);
            @event.SeatId.Should().Be(newSeatId);
        }