Expense(ProducerId producerId, DateTime occurred, Money cost, CategoryId categoryId) { this.producerId = producerId; this.occurredAt = occurred; this.cost = cost; this.categoryId = categoryId; }
public Purchase(CategoryId categoryId, DateTime happendOn, float price) { CategoryId = categoryId; HappendOn = happendOn; Price = price; }
//fits better in the lenguage public static Expense Produce(ProducerId producerId, DateTime occurred, Money cost, CategoryId categoryId) { Guard.ThrowIfItIsNull(producerId, nameof(producerId)); Guard.ThrowIfItIsNull(occurred, nameof(occurred)); Guard.ThrowIfItIsNull(cost, nameof(cost)); Guard.ThrowIfItIsNull(categoryId, nameof(categoryId)); return(new Expense(producerId, occurred, cost, categoryId)); }