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)); }
public void CreateDTOListTest() { HotelMapper _HotelMapper = MapperFactory.createHotelMapper(); List <Hotel> entities = new List <Hotel>(); entities.Add(_hotel); entities.Add(_hotel); var result = _HotelMapper.CreateDTOList(entities); Assert.IsInstanceOf <List <HotelDTO> >(result); }