public void AllParkingPlace_ExistingParkingPlace_ParkingPlaceReturned() { //Arrange var controller = new ParkingPlaceController(_parkingPlaceService, _mapper, _log); //Act var result = controller.AllParkingPlace().Result; //Asserts result.Should().ContainSingle(x => x.IDParkingPlace == 1 && x.Place == "dom"); }
public void DeleteParkingPlace_ExistingParkingPlace_StatusOk() { //Arrange var controller = new ParkingPlaceController(_parkingPlaceService, _mapper, _log); //Act var result = controller.DeleteParkingPlace(1); //Asserts result.Should().BeOfType <OkResult>(); _parkingPlaceService.Received(1).DeleteParkingPlace(Arg.Is <ParkingPlace>(x => x == _parkingPlace)); _parkingPlaceService.Received(1).SaveChanges(); _log.Received(1).Save(Arg.Any <string>(), "Usunięto rodzaj miejsca parkingowego", nameof(ParkingPlaceController)); }
public void DeleteParkingPlace_NonexistentParkingPlace_StatusNotFound() { //Arrange var controller = new ParkingPlaceController(_parkingPlaceService, _mapper, _log); //Act var result = controller.DeleteParkingPlace(2); //Asserts result.Should().BeOfType <NotFoundResult>(); _parkingPlaceService.DidNotReceive().DeleteParkingPlace(Arg.Any <ParkingPlace>()); _parkingPlaceService.DidNotReceive().SaveChanges(); _log.DidNotReceive().Save(Arg.Any <string>(), Arg.Any <string>(), nameof(ParkingPlaceController)); }
public void AddParkingPlace_NewParkingPlace_StatusOk() { //Arrange var controller = new ParkingPlaceController(_parkingPlaceService, _mapper, _log); var parkingPlace = new ParkingPlaceDTO { Place = "dom" }; //Act var result = controller.AddParkingPlace(parkingPlace); //Asserts result.Result.Should().BeOfType <OkResult>(); _parkingPlaceService.Received(1).AddParkingPlace(Arg.Any <ParkingPlace>()); _parkingPlaceService.Received(1).SaveChanges(); _log.Received(1).Save(Arg.Any <string>(), "Dodano rodzaj miejsca parkingowego", nameof(ParkingPlaceController)); }
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)); }