public void ReservationService_DeleteById_RepositoryReturnsNull_ReturnsNull()
        {
            //Arrange
            Reservation        nullReservation = null;
            Task <Reservation> reservation     = Task.FromResult(nullReservation);

            ReservationService reservationService = new ReservationService(_mockReservationsRepository.Object);

            _mockReservationsRepository.Setup(x => x.DeleteById(It.IsAny <Guid>(), It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(reservation);

            //Act
            var result = reservationService.DeleteById(_reservation.ProjectionId, _reservation.SeatId, _reservation.UserId).ConfigureAwait(false).GetAwaiter().GetResult();


            //Assert
            Assert.IsNull(result);
        }
Ejemplo n.º 2
0
        private void ConfirmPaymentButtonOnClick(object sender, EventArgs e)
        {
            Reservation reservation = reservationService.GetReservationByTableNumber(table.Number);

            if (reservation == null)
            {
                throw new Exception("Cannot find a reservation assosiated with this table");
            }

            Random random    = new Random();
            int    receiptId = random.Next();

            receiptService.AddReceipt(receiptId, selectedPaymentMethod, tipNumericUpDown.Value, feedbackTextbox.Text.Length > 0 ? feedbackTextbox.Text : null);
            orderService.UpdateReceiptIdByReservationId(reservation.Id, receiptId);
            reservationService.DeleteById(reservation.Id);

            mobileView.ResetTo(new TableView(), "Tafels");
        }
        public void ReservationService_DeleteById_ReturnsDeletedReservation()
        {
            //Arrange
            Task <Reservation> reservation = Task.FromResult(_reservation);

            ReservationService reservationService = new ReservationService(_mockReservationsRepository.Object);

            _mockReservationsRepository.Setup(x => x.DeleteById(It.IsAny <Guid>(), It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(reservation);

            //Act
            var result = reservationService.DeleteById(_reservation.ProjectionId, _reservation.SeatId, _reservation.UserId).ConfigureAwait(false).GetAwaiter().GetResult();


            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ReservationDomainModel));
            Assert.AreEqual(result.SeatId, _reservation.SeatId);
            Assert.AreEqual(result.UserId, _reservation.UserId);
            Assert.AreEqual(result.ProjectionId, _reservation.ProjectionId);
        }