Пример #1
0
        public async Task CancelReservation_ReservationExisting_ReservationCanceled()
        {
            await reservationService.CancelReservationAsync(reservationId);

            reservationRepositoryMock.Verify(m => m.GetByIdAsync(reservationId), Times.Once);
            reservationRepositoryMock.Verify(m => m.DeleteAsync(It.IsAny <Reservation>()), Times.Once);
        }
        public async Task CancelReservation_Returns_Error_When_CurrentDay_Equals_Reservation_StartDate()
        {
            _sut.CurrentTime = new DateTime(2017, 12, 2);
            Reservation existingReservation = new Reservation()
            {
                StartDate = new DateTime(2017, 12, 2),
                EndDate   = new DateTime(2017, 12, 15),
                BoardId   = _board.BoardId,
                Status    = ReservationStatus.Confirmed
            };

            _reservations.Add(existingReservation);

            ValidationResult result = await _sut.CancelReservationAsync(existingReservation);

            Assert.That(result, Is.Not.Null);
            CollectionAssert.Contains(result.Errors, "Solo se puede cancelar la reserva antes de que llegue el día de comienzo.");
            Assert.That(result.IsValid, Is.False);
            Assert.That(existingReservation.Status, Is.Not.EqualTo(ReservationStatus.Cancelled));
        }