private static IEnumerable <ProductValidationResult> ValidateName(ProductData product) { var reference = ProductsReference.GetInstance(); if (!reference.FindCodeByName(product.Name).HasValue) { yield return(new ProductValidationResult(product, "Unknown product name", ProductValidationSeverity.Error)); } }
private bool NameIsValid(ProductData product) { var reference = ProductsReference.GetInstance(); return(reference.FindCodeByName(product.Name).HasValue); }
public virtual ProductsReference GetProductsReferenceInstance() { return(ProductsReference.GetInstance()); }
public ProductValidator(ProductsReference productsReference, MeasureUnitsReference measureUnitsReference) { this.productsReference = productsReference ?? ProductsReference.GetInstance(); this.measureUnitsReference = measureUnitsReference ?? MeasureUnitsReference.GetInstance(); }
public ProviderProcessor(ProductsReference productsReference = null, MeasureUnitsReference measureUnitsReference = null, IProviderRepository repo = null) { this.productsReference = productsReference ?? ProductsReference.GetInstance(); this.measureUnitsReference = measureUnitsReference ?? MeasureUnitsReference.GetInstance(); this.repo = repo ?? new ProviderRepository(); }