/// <summary> /// Adds the barcode. /// </summary> /// <param name="barcodeAsBase64">The barcode as base64.</param> public void AddBarcode(String barcodeAsBase64) { Guard.ThrowIfNullOrEmpty(barcodeAsBase64, nameof(barcodeAsBase64)); this.CheckIfVoucherHasBeenGenerated(); this.CheckIfVoucherAlreadyIssued(); BarcodeAddedEvent barcodeAddedEvent = new BarcodeAddedEvent(this.AggregateId, this.EstateId, barcodeAsBase64); this.ApplyAndAppend(barcodeAddedEvent); }
public void BarcodeAddedEvent_CanBeCreated_IsCreated() { BarcodeAddedEvent barcodeAddedEvent = new BarcodeAddedEvent(TestData.VoucherId, TestData.EstateId, TestData.Barcode); barcodeAddedEvent.ShouldNotBeNull(); barcodeAddedEvent.AggregateId.ShouldBe(TestData.VoucherId); barcodeAddedEvent.EventId.ShouldNotBe(Guid.Empty); barcodeAddedEvent.VoucherId.ShouldBe(TestData.VoucherId); barcodeAddedEvent.EstateId.ShouldBe(TestData.EstateId); barcodeAddedEvent.Barcode.ShouldBe(TestData.Barcode); }
/// <summary> /// Plays the event. /// </summary> /// <param name="domainEvent">The domain event.</param> private void PlayEvent(BarcodeAddedEvent domainEvent) { this.Barcode = domainEvent.Barcode; }