Beispiel #1
0
        public ActionResult <ParkinglotDto> Createparkinglot([FromBody] ParkinglotDto parkinglotDto)
        {
            var newParkinglot = _parkinglotMapper.DtoToDomain(parkinglotDto);

            newParkinglot = _parkinglotService.CreateParkinglot(newParkinglot);
            return(Created($"api/parkinglots/{newParkinglot.Id}", parkinglotDto));
        }
        public void GivenCompletParkinglotDto_WhenCreatingNewParkinglot_ThenReturnStatusCode201WithParkinglotDto()
        {
            //Given
            ParkinglotDto parkinglotDto = new ParkinglotDto();
            Parkinglot    parkinglot    = new Parkinglot();

            //_parkinglotMapper.DtoToDomain(parkinglotDto).Returns(parkinglot);
            _parkinglotService.CreateParkinglot(_parkinglotMapper.DtoToDomain(parkinglotDto)).Returns(parkinglot);

            //When
            CreatedResult returnValue = (CreatedResult)_parkinglotController.Createparkinglot(parkinglotDto).Result;

            //then
            Assert.Equal(201, returnValue.StatusCode);
        }