Ejemplo n.º 1
0
        public Ean(long ean)
        {
            if (ean < 779_000000000_0 || ean > 779_999999999_9)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (!Ean.EsValido(ean))
            {
                throw new ArgumentException();
            }

            valor = ean;
        }
Ejemplo n.º 2
0
        public Producto(Ean codigo, string descripcion, Importe precio)
        {
            if (codigo == null)
            {
                throw new ArgumentNullException();
            }
            if (descripcion == null)
            {
                throw new ArgumentNullException();
            }
            if (descripcion.Length < 1)
            {
                throw new ArgumentException();
            }
            if (precio == null)
            {
                throw new ArgumentNullException();
            }

            Codigo      = codigo;
            Descripcion = descripcion;
            Precio      = precio;
        }
Ejemplo n.º 3
0
 public bool Equals(Ean otro) => otro?.valor.Equals(valor) ?? false;