public RemoverLinea ( int productoId ) : void | ||
productoId | int | |
Результат | void |
public void RemoverLinea(int productoId)
{
LineaCarroCompras linea = BuscarLinea(productoId);
if (linea == null)
throw new Exception("No existe el producto");
this.detalle.RemoveAll(l => l.Producto.Id == productoId);
}
public void RemoverLinea_ProductoExiste_RemueveLaLinea() { //Arrange var carroCompras = new CarroCompras(); carroCompras.AgregarLinea(new Producto { Id = 1 }); //Act carroCompras.RemoverLinea(1); //Assert Assert.AreEqual(0, carroCompras.CantidadProductos); }