示例#1
0
        public async Task <IActionResult> Reservations()
        {
            var reservationService = new ReservationService(new ReservationRepository(_context), new Repository <Room>(_context), _mapper);
            var reservations       = await reservationService.GetAll();

            return(View(new ReservationViewModel(reservations)));
        }
        public void ReservationGetAllTest()
        {
            var resevations = DataForTests.Reservations;
            EFWorkUnitMock.Setup(x => x.Reservations.GetAll()).Returns(resevations);

            var reservationService = new ReservationService(EFWorkUnitMock.Object);
            var result = reservationService.GetAll();
            var expected = toDTOMapper.Map<List<Reservation>, List<ReservationDTO>>(resevations);

            CollectionAssert.AreEqual(expected, result.ToList());
        }
示例#3
0
            public void ReturnAllReservations()
            {
                var repo = new Mock <IReservationRepository>();

                repo
                .Setup(r => r.GetAll(It.IsAny <DateTime>(), 123))
                .Returns(new List <Reservation>()
                {
                    new Reservation(new Employee("John Doe"), new Room("Pahiyas"), new Schedule(new DateTime(2018, 1, 1), new DateTime(2018, 1, 2)))
                });

                var service = new ReservationService(repo.Object);
                var sut     = service.GetAll(DateTime.Now, 123);

                sut.Should().HaveCount(1);
            }
示例#4
0
        private void DisplayReservations()
        {
            List <Reservation> reservations = reservationService.GetAll();

            listViewReservations.Clear();
            listViewReservations.Columns.Add("Id", 30);
            listViewReservations.Columns.Add("Customer", 100);
            listViewReservations.Columns.Add("Book", -2);
            foreach (Reservation reservation in reservations)
            {
                ListViewItem item = new ListViewItem(reservation.Id.ToString());
                item.SubItems.Add(reservation.Customer.ToString());
                item.SubItems.Add(reservation.Book.ToString());
                item.Tag = reservation;
                listViewReservations.Items.Add(item);
            }
        }
示例#5
0
 public async Task <ActionResult <DataCollection <ReservationDTO> > > GetAll(int page, int take)
 {
     return(await _ReservationService.GetAll(page, take));
 }
示例#6
0
        public async Task GetReservations_ReservationsExisting_ReservationsReturned()
        {
            await reservationService.GetAll();

            reservationRepositoryMock.Verify(m => m.ListAsync(It.IsAny <ISpecification <Reservation> >()), Times.Once);
        }