public Product(Guid id, string name, string?description, decimal price, decimal deliveryPrice) : base(id) { var command = new CreateProductCommand { ProductId = id, Name = name, Description = description, Price = price, DeliveryPrice = deliveryPrice }; var validator = new CreateProductCommandValidator(); validator.ValidateAndThrow(command); Name = command.Name; Description = command.Description; Price = command.Price; DeliveryPrice = command.DeliveryPrice; _productOptions = new List <ProductOption>(); }
/// <summary> /// Returns true if ... is valid. /// </summary> /// <returns><c>true</c> if this instance is valid; otherwise, <c>false</c>.</returns> public override bool IsValid() { ValidationResult = new CreateProductCommandValidator().Validate(this); return(ValidationResult.IsValid); }
public void Setup() { _validator = new CreateProductCommandValidator(UnitOfWork); }