public async Task ExecuteAsync() { var Truck = await FindTruck(findTruckQuery); PrintTruck(Truck); WriteLine(); WriteLine("Você pode modificar a cor do Caminhão."); var color = await SelectColor(getColorOptions); var modelYear = ReadModelYear(); var manufactureYear = ReadManufactureYear(); var command = new EditTruck(Truck.Chassis, color.Id, modelYear, manufactureYear); var result = await editTruck.ExecuteAsync(command); if (!result.IsSuccess) { WriteLine($"Não foi possível realizar a edição: {result.Message}."); return; } WriteLine("Caminhão editado com sucesso!"); }
public async Task Command_Execute_ShouldEdit() { var context = GetInMemorySeededContext(); var update = new EditTruckCommand(context); var command = new EditTruck("TEST1", 2, 3, 4); await update.ExecuteAsync(command); var updatedTruck = context.Truck.Find("TEST1"); Assert.AreEqual(2, updatedTruck.ColorId); }