public void When_update_a_vehicle_not_stored_return_fail() { IVehicle vehicle = new CustomVehicle() { Type = Core.Domain.VehicleType.Truck, NumberOfPassagers = 1, Color = "BLUE", ChassisId = new Core.Domain.Chassis() { ChassisNumber = 9999, ChassisSeries = Guid.NewGuid().ToString() } }; var result = fleetManager.UpdateVehicleRegister(vehicle).HandlerErrors().Result(); Assert.True(result.IsFail, "The operation not failed for an invalid vehicle!"); Assert.True(result.ValidationResult.Any(a => !a.IsValid), "There aren't fail validation results for an invalid vehicle!"); }
private void UpdateColor(IVehicle vehicle) { Console.WriteLine(); Console.Write("Enter the vehicle color: "); var color = Input.ReadLine(exitKey: ConsoleKey.Escape); vehicle.Color = color; var result = FleetManager.UpdateVehicleRegister(vehicle).HandlerErrors().Result(); if (result.IsFail) { Console.WriteLine("Some errors occured"); this.ShowValidationErrors(result.ValidationResult); } else { this.ShowSuccessMessage(); } }