public void TryAcceptReturnsNullOnReservationInThePast( Reservation reservation, IReadOnlyCollection <Reservation> reservations, int id, MaîtreDEffects sut) { reservation.IsAccepted = false; var actual = sut.TryAccept(reservation); Assert.Null( actual.Run(new StubReservationsHandler(false, reservations, id)).Result); Assert.False(reservation.IsAccepted); }
public void TryAcceptReturnsNullOnInsufficientCapacity( Reservation reservation, IReadOnlyCollection <Reservation> reservations, int id, MaîtreDEffects sut) { reservation.IsAccepted = false; var reservedSeats = reservations.Sum(r => r.Quantity); sut = sut.WithCapacity(reservedSeats + reservation.Quantity - 1); var actual = sut.TryAccept(reservation); Assert.Null( actual.Run(new StubReservationsHandler(true, reservations, id)).Result); Assert.False(reservation.IsAccepted); }
public void TryAcceptReturnsReservationIdInHappyPathScenario( Reservation reservation, IReadOnlyCollection <Reservation> reservations, MaîtreDEffects sut, int excessCapacity, int expected) { var reservedSeats = reservations.Sum(r => r.Quantity); reservation.IsAccepted = false; sut = sut.WithCapacity( reservedSeats + reservation.Quantity + excessCapacity); var actual = sut.TryAccept(reservation); Assert.Equal( expected, actual.Run(new StubReservationsHandler(true, reservations, expected)).Result); Assert.True(reservation.IsAccepted); }