public async Task VehiclesService_Test_Call_All_CRUD_Methods_ShouldWork() { // Arrange // Act var actualVehicleCount = await _myShuttleClient.VehiclesService.GetCountAsync(string.Empty); var newVehicle = new Vehicle() { LicensePlate = "SLV-4335", Model = "Silver Bullet", Make = "Silver Bullet Factory", Type = VehicleType.Compact, Seats = 4, VehicleStatus = VehicleStatus.Free, DriverId = 1, CarrierId = 1, Picture = null, Longitude = 10, Latitude = 10, RatingAvg = 1, TotalRides = 1, }; var vehicleId = await _myShuttleClient.VehiclesService.PostAsync(newVehicle); //Assert vehicleId.Should().BeGreaterThan(0); var newVehicleCount = await _myShuttleClient.VehiclesService.GetCountAsync(string.Empty); newVehicleCount.Should().Be(actualVehicleCount + 1); var currentVehicle = await _myShuttleClient.VehiclesService.GetAsync(vehicleId); //assert currentVehicle.Should().NotBeNull(); currentVehicle.LicensePlate = Guid.NewGuid().ToString(); await _myShuttleClient.VehiclesService.PutAsync(currentVehicle); var updateDriver = await _myShuttleClient.VehiclesService.GetAsync(vehicleId); updateDriver.Should().NotBeNull(); updateDriver.LicensePlate.Should().Be(currentVehicle.LicensePlate); await _myShuttleClient.VehiclesService.DeleteAsync(vehicleId); newVehicleCount = await _myShuttleClient.VehiclesService.GetCountAsync(string.Empty); newVehicleCount.Should().Be(actualVehicleCount); }
private async void UpdateSelectedDriver(Vehicle selectedVehicle) { SelectedDriver = null; if (selectedVehicle == null) { IsLoadingDriver = false; return; } if (!IsDriverCompleteLoaded(selectedVehicle.Driver)) { IsLoadingDriver = true; selectedVehicle.Driver = await MyShuttleClient.DriversService.GetAsync(selectedVehicle.DriverId); } if (SelectedVehicle == selectedVehicle) { SelectedDriver = selectedVehicle.Driver; IsLoadingDriver = false; } }