public void UpdateParkingPlace_ExistingParkingPlace_StatusOk() { //Arrange var controller = new ParkingPlaceController(_parkingPlaceService, _mapper, _log); var parkingPlace = new ParkingPlaceDTO { Place = "dom" }; //Act var result = controller.UpdateParkingPlace(parkingPlace, 1); //Asserts result.Should().BeOfType <OkResult>(); _mapper.Received().Map(parkingPlace, _parkingPlace); _parkingPlaceService.Received(1).UpdateParkingPlace(Arg.Is <ParkingPlace>(x => x == _parkingPlace)); _parkingPlaceService.Received(1).SaveChanges(); _log.Received(1).Save(Arg.Any <string>(), "Edytowano rodzaj miejsca parkingowego", nameof(ParkingPlaceController)); }
public void UpdateParkingPlace_NonexistentParkingPlace_StatusNotFound() { //Arrange var controller = new ParkingPlaceController(_parkingPlaceService, _mapper, _log); var parkingPlace = new ParkingPlaceDTO { Place = "dom" }; //Act var result = controller.UpdateParkingPlace(parkingPlace, 2); //Asserts result.Should().BeOfType <NotFoundResult>(); _mapper.DidNotReceive().Map(Arg.Any <EnginePowerDTO>(), Arg.Any <ParkingPlace>()); _parkingPlaceService.DidNotReceive().UpdateParkingPlace(Arg.Any <ParkingPlace>()); _parkingPlaceService.DidNotReceive().SaveChanges(); _log.DidNotReceive().Save(Arg.Any <string>(), Arg.Any <string>(), nameof(ParkingPlaceController)); }