Пример #1
0
        /// <summary>
        /// Method for search reservation of specified by <paramref name="number"/> room
        /// </summary>
        /// <param name="roomId">identifier of room</param>
        /// <returns>operation result with <see cref="Reservation"/> collection</returns>
        public async Task <BaseOperationResult <IEnumerable <Reservation> > > GetRoomCurrentReservations(string roomId)
        {
            var reservationCurrent = new RoomReservationsRequestModel()
            {
                From   = DateTime.Now,
                To     = DateTime.Now.AddHours(1),
                RoomId = int.Parse(roomId)
            };

            return(await(this.roomRepository as IRoomRepository)?.GetCurrentRoomReservation(reservationCurrent));
        }
Пример #2
0
        public async Task GetCurrentRoomReservations_Should_Call_HttpService_Get_With_Correct_URL()
        {
            //arrange
            RoomRepository roomRepository    = new RoomRepository(this.httpServiceMock.Object);
            var            reservationsModel = new RoomReservationsRequestModel()
            {
                From   = new DateTime(2016, 9, 22, 3, 0, 0),
                To     = new DateTime(2016, 9, 22, 5, 0, 0),
                RoomId = 1
            };

            string expectedRoute = string.Format(RestURl.GetCurrentRoomReservation,
                                                 "22-Sep-16 12:00:00 AM",
                                                 "22-Sep-16 2:00:00 AM",
                                                 "1");

            //act
            await roomRepository.GetCurrentRoomReservation(reservationsModel);

            //assert
            this.httpServiceMock.Verify(m => m.Get <IEnumerable <Reservation> >(expectedRoute), Times.Once);
        }
Пример #3
0
        /// <summary>
        /// Method for getting active reservation which satisfied <paramref name="reservationsModel"/>
        /// </summary>
        /// <param name="reservationsModel">contains room details</param>
        /// <returns>operation result with status code and room reservation</returns>
        public async Task <BaseOperationResult <IEnumerable <Reservation> > > GetCurrentRoomReservation(RoomReservationsRequestModel reservationsModel)
        {
            var root = string.Format(
                RestURl.GetCurrentRoomReservation,
                reservationsModel.From.ToUniversalTime().ToString(this.dateTimeCultureInfo),
                reservationsModel.To.ToUniversalTime().ToString(this.dateTimeCultureInfo),
                reservationsModel.RoomId);

            return(await this.HttpService.Get <IEnumerable <Reservation> >(root));
        }
Пример #4
0
 public Task <BaseOperationResult <IEnumerable <Reservation> > > GetCurrentRoomReservation(RoomReservationsRequestModel reservationsModel)
 {
     return(Task.FromResult(FakeData.ReservationList));
 }