public void GivenListParkinglotDto_WhenGetAll_ThenReturnOKWithList()
        {
            //Given
            ParkinglotDto        parkinglotDto     = new ParkinglotDto();
            List <ParkinglotDto> listParkinglotDto = new List <ParkinglotDto>()
            {
                parkinglotDto
            };

            Parkinglot        parkinglot     = new Parkinglot();
            List <Parkinglot> listParkinglot = new List <Parkinglot>()
            {
                parkinglot
            };

            _parkinglotService.GetAll().Returns(listParkinglot);

            //_parkinglotMapper.ListToDtoList(listParkinglot).Returns(listParkinglotDto);

            //When
            OkObjectResult ok = (OkObjectResult)_parkinglotController.GetAllParkinglots().Result;

            //ActionResult<List<ParkinglotDto>> returnValue = _parkinglotController.GetAllParkinglots();


            //then
            //OkObjectResult returnValue = (OkObjectResult)_parkinglotController.GetAllParkinglots().Result;
            Assert.Equal(200, ok.StatusCode);
            Assert.IsType <List <ParkinglotDto> >(ok.Value);
        }
Ejemplo n.º 2
0
        public ActionResult <List <ParkinglotDto> > GetAllParkinglots()
        {
            var allParkinglots    = _parkinglotService.GetAll();
            var allParkinglotsDto = _parkinglotMapper.ListToDtoList(allParkinglots);

            return(Ok(allParkinglotsDto));
        }