public VehicleType(string description, byte capacity)
        {
            AssertionConcern.AssertArgumentNotNull(description, "Descrição do tipo do veículo não pode ser nula.");
            AssertionConcern.AssertArgumentLength(description, 2, 50, "Descrição do tipo do veículo deve ter entre 2 e 50 caracteres.");
            AssertionConcern.AssertArgumentGreaterThanZero(capacity, "Capacidade do tipo do veículo deve ser maior que zero.");

            this.Description = description;
            this.Capacity    = capacity;
        }
        public Vehicle(string chassi, string color, int vehicleTypeId)
        {
            AssertionConcern.AssertArgumentNotNull(chassi, "Chassi do veículo não pode ser nulo.");
            AssertionConcern.AssertArgumentLength(chassi, 17, 17, "Chassi deve ter 17 caracteres.");
            AssertionConcern.AssertArgumentNotNull(color, "Cor do veículo não pode ser nula.");
            AssertionConcern.AssertArgumentLength(color, 2, 50, "Cor do veículo deve ter entre 2 e 50 caracteres.");
            AssertionConcern.AssertArgumentGreaterThanZero(vehicleTypeId, "Tipo do veículo não pode ser vazio.");

            this.Chassi        = chassi;
            this.Color         = color;
            this.VehicleTypeId = vehicleTypeId;
        }
Exemplo n.º 3
0
        public void Validate(int id, int idOrder, int idProduct, int quantity)
        {
            if (id > 0)
            {
                this.Id = id;
            }

            if (AssertionConcern.AssertArgumentGreaterThanZero(idOrder, Errors.OrderInvalid))
            {
                this.IdOrder = idOrder;
            }

            if (AssertionConcern.AssertArgumentGreaterThanZero(idProduct, Errors.ProductInvalid))
            {
                this.IdProduct = idProduct;
            }

            if (AssertionConcern.AssertArgumentGreaterThanZero(quantity, Errors.QuantityInvalid))
            {
                this.Quantity = quantity;
            }
        }