public void Get_Returns_Specific_Reservation()
        {
            // Arrange
            LibraryContextMock    mockContext = new LibraryContextMock();
            ReservationRepository repo        = new ReservationRepository(mockContext);
            BookRepository        bookRepo    = new BookRepository(mockContext);
            Book newBook = new Book()
            {
                title       = "New title",
                author      = "New author",
                isbn        = "22222",
                publishDate = "2001"
            };
            Reservation newReservation1 = new Reservation()
            {
                id = 0, book = newBook
            };
            Reservation newReservation2 = new Reservation()
            {
                id = 1, book = newBook
            };

            bookRepo.Add(newBook);
            repo.Add(newReservation1);
            repo.Add(newReservation2);

            // Act
            Reservation Reservation = repo.Get(1);

            // Asert
            Assert.Equal(newReservation2, Reservation);
        }
示例#2
0
 // GET /api/employees/
 public IEnumerable <ReservationResponse> Get()
 {
     return(_reservationRepository.Get().Select(reservation => new ReservationResponse {
         Id = reservation.Id,
         ReservationNo = reservation.ReservationNo,
         DateTimeStart = reservation.DateTimeStart.ToString(),
         DateTimeEnd = reservation.DateTimeEnd.ToString(),
         State = reservation.State,
         CustomerId = reservation.CustomerId,
         VenueId = reservation.VenueId,
         TableId = reservation.TableId,
         CreatedAt = reservation.CreatedAt.ToString(),
         UpdatedAt = reservation.UpdatedAt.ToString(),
         Table = _tablesController.Get(reservation.TableId),
         TablePackages = _reservationsTablePackagesController.GetTablePackagesByReservationId(reservation.Id)
     }));
 }
        public void AddReservationFromText()
        {
            Reservation testReservation = new Reservation(_student, _room1, 5, _dateFrom, _dateTo);

            _repoReservation.Add(_student, _room1, 5, _dateFrom, _dateTo);
            _reservationList = _repoReservation.Get();
            Assert.IsTrue(_reservationList.Contains(testReservation));
        }
示例#4
0
 public Reservation GetReservation(int id)
 {
     return(repo.Get(id));
 }
示例#5
0
 public Reservation GetReservation(int id)
 {
     return(_reservationRepository.Get(id));
 }
示例#6
0
 public Reservation GetReservation(Int32 id)
 {
     return(repo.Get(id));
 }
 public void GetReservationsByUser()
 {
     _reservationList = _repoReservation.Get(_student);
     Assert.IsTrue(_reservationList.Contains(_reservation1));
 }
示例#8
0
        public List <Reservation> GetReservationList()
        {
            List <Reservation> reservationList = _reservRepo.Get(LoggedIn.User);

            return(reservationList);
        }
 public Reservation Get(int id) => _repo.Get(id);