public void SetPrice(decimal price) { AssertionConcern.AssertArgumentNotNull(price, Errors.UnitPriceRequired); AssertionConcern.AssertArgumentRange(price, 0, PriceMaxValue, string.Format(Errors.UnitPriceRange, 0, PriceMaxValue)); Price = price; }
public static bool ValidNumber(this Address address) { return(AssertionConcern.IsValid( AssertionConcern.AssertArgumentNotEmpty(address.Number.ToString(), "Informe o número"), AssertionConcern.AssertArgumentRange(address.Number, 1, 99999, "Número inválido.") )); }
public void ValidaModelo() { AssertionConcern.AssertArgumentRange(VendedorId, 0, "Codigo do vendedor é inválido"); AssertionConcern.AssertArgumentRange(ProdutoId, 0, "Codigo do produto é inválido"); AssertionConcern.AssertArgumentRange(QuantidadeProduto, 0, "Quantidade é inválida"); AssertionConcern.AssertArgumentRange(ValorTotal, 0, "Valor total é inválido"); }
public PropertyUnity(string description, decimal value) { AssertionConcern.AssertArgumentNotEmpty(description, $"Parameter {nameof(description)} cannot be empty or null"); AssertionConcern.AssertArgumentRange(value, 0, decimal.MaxValue, $"Parameter {nameof(value)} is not in range 0, {decimal.MaxValue}"); this.Id = Guid.NewGuid(); this.Description = description; this.Value = value; }
public OrderItem(Product product, int quantity) { Product = product; Quantity = quantity; Price = Product.Price; AssertionConcern.AssertArgumentIsBiggerThan(Price, 0, "A O preco nao pode ser zero!"); AssertionConcern.AssertArgumentRange(Quantity, 1, 10000000, "A Quantidete tem que ser maior que zero"); }
public BusinessPriorityRatings(int benefit, int penalty, int cost, int risk) { AssertionConcern.AssertArgumentRange(benefit, 1, 9, "Relative benefit must be between 1 and 9."); AssertionConcern.AssertArgumentRange(penalty, 1, 9, "Relative penalty must be between 1 and 9."); AssertionConcern.AssertArgumentRange(cost, 1, 9, "Relative cost must be between 1 and 9."); AssertionConcern.AssertArgumentRange(risk, 1, 9, "Relative risk must be between 1 and 9."); this.Benefit = benefit; this.Penalty = penalty; this.Cost = cost; this.Risk = risk; }
public Property(string description, string address, int number, IEnumerable <PropertyUnity> unities) { AssertionConcern.AssertArgumentNotEmpty(description, $"Parameter {nameof(description)} cannot be empty or null"); AssertionConcern.AssertArgumentNotEmpty(address, $"Parameter {nameof(address)} cannot be empty or null"); AssertionConcern.AssertArgumentRange(number, 0, int.MaxValue, $"Parameter {nameof(number)} is out of range {0}, {int.MaxValue}"); EnumerableConcern.AssertMinimumLength(unities, 1, $"Parameter {nameof(unities)} need at least 1 item"); this.Id = Guid.NewGuid(); this.Description = description; this.Address = address; this.Number = number; this.Unities = unities; }
public void SetNumeroEleitoral(CargoEletivo cargoEletivo, int numeroEleitoral) { switch (cargoEletivo) { case CargoEletivo.Presidente: AssertionConcern.AssertArgumentRange(numeroEleitoral, 10, 99, ValidationErrorMessage.CandidatoNumeroEleitoralPresidenteInvalidRange); break; case CargoEletivo.Governador: AssertionConcern.AssertArgumentRange(numeroEleitoral, 10, 99, ValidationErrorMessage.CandidatoNumeroEleitoralGovernadorInvalidRange); break; case CargoEletivo.Prefeito: AssertionConcern.AssertArgumentRange(numeroEleitoral, 10, 99, ValidationErrorMessage.CandidatoNumeroEleitoralPrefeitoInvalidRange); break; case CargoEletivo.Senador: AssertionConcern.AssertArgumentRange(numeroEleitoral, 10, 999, ValidationErrorMessage.CandidatoNumeroEleitoralSenadorInvalidRange); break; case CargoEletivo.DeputadoFederal: AssertionConcern.AssertArgumentRange(numeroEleitoral, 10, 99999, ValidationErrorMessage.CandidatoNumeroEleitoralDeputadoFederalInvalidRange); break; case CargoEletivo.DeputadoEstadual: AssertionConcern.AssertArgumentRange(numeroEleitoral, 10, 99999, ValidationErrorMessage.CandidatoNumeroEleitoralDeputadoEstadualInvalidRange); break; case CargoEletivo.Vereador: AssertionConcern.AssertArgumentRange(numeroEleitoral, 10, 99999, ValidationErrorMessage.CandidatoNumeroEleitoralVereadorInvalidRange); break; } CargoEletivo = cargoEletivo; NumeroEleitoral = numeroEleitoral; }
public void Should_ThrowsAssertArgumentRange_Float() { AssertionConcern.AssertArgumentRange(20.0F, 0.0F, 10.0F, ErrorMessage); }
public void Should_AssertArgumentRange_Int() { Assert.DoesNotThrow(() => AssertionConcern.AssertArgumentRange(5, Int32.MinValue, Int32.MaxValue, ErrorMessage)); }
public void Should_ThrowsAssertArgumentRange_Double() { AssertionConcern.AssertArgumentRange(20.0, 0.0, 10.0, ErrorMessage); }
public void Should_AssertArgumentRange_Float() { Assert.DoesNotThrow(() => AssertionConcern.AssertArgumentRange(5.0F, float.MinValue, float.MaxValue, ErrorMessage)); }
protected void SelfAssertArgumentRange(double value, double minimum, double maximum, string message) { AssertionConcern.AssertArgumentRange(value, minimum, maximum, message); }
public void Should_AssertArgumentRange_Double() { Assert.DoesNotThrow(() => AssertionConcern.AssertArgumentRange(5.0, double.MinValue, double.MaxValue, ErrorMessage)); }
protected void SelfAssertArgumentRange(int value, int minimum, int maximum, string message) { AssertionConcern.AssertArgumentRange(value, minimum, maximum, message); }
protected void SelfAssertArgumentRange(long value, long minimum, long maximum, string message) { AssertionConcern.AssertArgumentRange(value, minimum, maximum, message); }
public void ValidaModelo() { AssertionConcern.AssertArgumentNotEmpty(Descricao, $"Descrição do produto é inválida."); AssertionConcern.AssertArgumentRange(PrecoUnitario, 0, $"Preço unitario {PrecoUnitario} é inválido"); }
public void Should_AssertArgumentRange_Long() { Assert.DoesNotThrow(() => AssertionConcern.AssertArgumentRange(1234567890123, long.MinValue, long.MaxValue, ErrorMessage)); }
public void Validate() { AssertionConcern.AssertArgumentNotEmpty(Technology, "A tecnologia trabalhada precisa ser preenchida."); AssertionConcern.AssertArgumentRange(TimeExperience, 0.0, 1000.0, "O tempo de experiencia deve está entre 0 e 1000"); AssertionConcern.AssertArgumentNotEmpty(DetailExperience, "A descrição da experiencia precisa ser preenchida."); }
public void Should_ThrowsAssertArgumentRange_Long() { AssertionConcern.AssertArgumentRange(20, 0, 10, ErrorMessage); }
public void SetUnitPrice(decimal unitPrice) { AssertionConcern.AssertArgumentNotNull(unitPrice, Errors.NameRequired); AssertionConcern.AssertArgumentRange(unitPrice, (decimal)0.01, UnitPriceMaxValue, string.Format(Errors.UnitPriceRange, (decimal)0.01, UnitPriceMaxValue)); UnitPrice = unitPrice; }
private void SetOrderDetails(List <OrderDetail> orderDetails) { AssertionConcern.AssertArgumentRange(orderDetails.Count, 1, 500, "Orders should have a minimum of one item."); OrderDetails = orderDetails; }
public void SetQuantity(int quantity) { AssertionConcern.AssertArgumentNotNull(quantity, Errors.QuantityRequired); AssertionConcern.AssertArgumentRange(quantity, 1, int.MaxValue, string.Format(Errors.QuantityRange, 1, int.MaxValue)); Quantity = quantity; }