public void getCantidadItemsTest() { UltimoMovimientoDataMapper target = new UltimoMovimientoDataMapper(); // TODO: Inicializar en un valor adecuado ITEM item = new ITEM(); // TODO: Inicializar en un valor adecuado INFRAESTRUCTURA infraestructura = new INFRAESTRUCTURA(); // TODO: Inicializar en un valor adecuado item.UNID_ITEM = 20130103181604156; infraestructura.UNID_INFRAESTRUCTURA = 2; ULTIMO_MOVIMIENTO expected = new ULTIMO_MOVIMIENTO(); expected.CANTIDAD = 100;// TODO: Inicializar en un valor adecuado ULTIMO_MOVIMIENTO actual; actual = target.getCantidadItems(item, infraestructura); Assert.AreEqual(expected.CANTIDAD, actual.CANTIDAD); }
public void loadItems(ALMACEN almacenDirecto, string Rafa) { try { bool ban = false; this.Mensaje1 = ""; this.Mensaje2 = ""; object element = this._dataMapper.getElements_EntradasSalidasSerie2(almacenDirecto, this._serie, this._sku); FixupCollection <ItemModel> ic = new FixupCollection <ItemModel>(); if (this.ItemModel.Count != 0) { foreach (ItemModel elem in this.ItemModel) { if (elem.IsChecked) { ic.Add(elem); } } } this.ItemModel.Clear(); if (element != null) { foreach (ITEM elemento in (List <ITEM>)element) { ban = true; ItemModel aux = new ItemModel(elemento); UltimoMovimientoDataMapper ultimomovimientodm = new UltimoMovimientoDataMapper(); ULTIMO_MOVIMIENTO tmp = new ULTIMO_MOVIMIENTO(); if (almacenDirecto != null) { tmp = ultimomovimientodm.getCantidadItems(elemento, almacenDirecto); } aux.CantidadDisponible = tmp.CANTIDAD; aux.CantidadMovimiento = 1; aux.ItemStatus = tmp.ITEM_STATUS; if (aux.CantidadDisponible > 0) { bool auxx = true; foreach (ItemModel elem in ic) { if (elem.UNID_ITEM == aux.UNID_ITEM && elem.NUMERO_SERIE == aux.NUMERO_SERIE && elem.SKU == aux.SKU) { auxx = false; } } if (auxx) { aux.IsChecked = true; ic.Add(aux); } } else { this.Mensaje1 = "Este artículo no se encuentra en el lugar especificado"; } } } if (ic != null) { this.ItemModel = ic; } if (!ban) { this.Mensaje1 = "Este artículo no se encuentra en el almacén seleccionado"; object element2 = this._dataMapper.getAlmacenDisponible(this._serie, this._sku); bool aux = false; this.Mensaje2 = "El artículo se encuentra en: "; foreach (ULTIMO_MOVIMIENTO um in (List <ULTIMO_MOVIMIENTO>)element2) { aux = true; if (um.CLIENTE != null) { this.Mensaje2 += " El cliente: " + um.CLIENTE.CLIENTE1; aux = true; } if (um.PROVEEDOR != null) { aux = true; this.Mensaje2 += " El proveedor: " + um.PROVEEDOR.PROVEEDOR_NAME; } if (um.INFRAESTRUCTURA != null) { aux = true; this.Mensaje2 += " La infraestructura: " + um.INFRAESTRUCTURA.INFRAESTRUCTURA_NAME; } if (um.ALMACEN != null) { aux = true; this.Mensaje2 += " El almacén: " + um.ALMACEN.ALMACEN_NAME; } } if (!aux) { this.Mensaje2 = "El artículo no se encuentra en ningún almacen"; } } } catch (ArgumentException ae) { ; } catch (Exception ex) { throw ex; } }