public ActionResult <IEnumerable <HotelDTO> > Get([FromQuery] int location = -1)
        {
            GetHotelsCommand       commandHotels = CommandFactory.GetHotelsCommand();
            GetHotelsByCityCommand commandByCity = CommandFactory.GetHotelsByCityCommand(location);

            commandHotels.Execute();
            commandByCity.Execute();
            var resulthotel = commandHotels.GetResult();

            _logger?.LogInformation($"Se obtuvieron los hoteles exitosamente");
            var resultcity = commandByCity.GetResult();

            _logger?.LogInformation($"Obtenida las ciudades exitosamente por: {location}");
            HotelMapper hotelMapper = MapperFactory.createHotelMapper();

            return(location == -1
                ?  hotelMapper.CreateDTOList(resulthotel)
                :  hotelMapper.CreateDTOList(resultcity));
        }
Beispiel #2
0
        public void GetHotelsTest()
        {
            int i = 0;

            while (i < 3)
            {
                AddHotelCommand AddHotel = CommandFactory.createAddHotelCommand(_hotel);
                AddHotel.Execute();
                var hotelId = AddHotel.GetResult();
                _insertedHotels.Add(hotelId);
                i++;
            }

            GetHotelsCommand GetHotels = CommandFactory.GetHotelsCommand();

            GetHotels.Execute();
            var hotelsList = GetHotels.GetResult();

            Assert.True(hotelsList.Count >= 3);
        }