public InvoiceDetail(string detail, decimal unitaryCost, int amount) { Id = new Guid(); Detail = detail; UnitaryCost = unitaryCost; Amount = amount; }
protected override void When(object @event) { switch (@event) { case Domain.Events.Authorization.AuthorizationCreated e: Id = new AuthorizationGuid(e.AuthorizationId); AuthorizationId = Id.Value; AuthorizationNumber = NumericString.FromString(e.AuthorizationNumber); TaxEmitterNumber = NumericString.FromString(e.TaxEmitterNumber); Name = StringNotNull.FromString(e.Name); LastEmmitedNumber = NumericNonNegative.FromInt(e.LastEmmitedNumber); ExpirationDate = e.ExpirationDate; Status = StatusAuthorization.Enabled; break; case Domain.Events.Authorization.AuthorizationDestroyed e: Status = StatusAuthorization.Disabled; break; } }