public static void LoadTypes() { VoucherIssuedEvent v = new VoucherIssuedEvent(Guid.NewGuid(), Guid.NewGuid(), DateTime.Now, "", ""); TransactionHasStartedEvent t = new TransactionHasStartedEvent(Guid.Parse("2AA2D43B-5E24-4327-8029-1135B20F35CE"), Guid.NewGuid(), Guid.NewGuid(), DateTime.Now, "", "", "", "", null); ReconciliationHasStartedEvent r = new ReconciliationHasStartedEvent(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), DateTime.Now); EstateCreatedEvent e = new EstateCreatedEvent(Guid.NewGuid(), ""); MerchantCreatedEvent m = new MerchantCreatedEvent(Guid.NewGuid(), Guid.NewGuid(), "", DateTime.Now); ContractCreatedEvent c = new ContractCreatedEvent(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ""); MerchantBalanceChangedEvent mb = new MerchantBalanceChangedEvent(Guid.NewGuid(), Guid.NewGuid(), DateTime.Now, Guid.NewGuid(), Guid.NewGuid(), 0, 0, 0, ""); ImportLogCreatedEvent i = new ImportLogCreatedEvent(Guid.NewGuid(), Guid.NewGuid(), DateTime.MinValue); FileCreatedEvent f = new FileCreatedEvent(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), String.Empty, DateTime.MinValue); SettlementCreatedForDateEvent s = new SettlementCreatedForDateEvent(Guid.NewGuid(), Guid.NewGuid(), DateTime.Now); StatementCreatedEvent ms = new StatementCreatedEvent(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), DateTime.Now); TypeProvider.LoadDomainEventsTypeDynamically(); }
public void ImportLogCreatedEvent_CanBeCreated_IsCreated() { ImportLogCreatedEvent importLogCreatedEvent = new ImportLogCreatedEvent(TestData.FileImportLogId, TestData.EstateId, TestData.ImportLogDateTime); importLogCreatedEvent.FileImportLogId.ShouldBe(TestData.FileImportLogId); importLogCreatedEvent.EstateId.ShouldBe(TestData.EstateId); importLogCreatedEvent.ImportLogDateTime.ShouldBe(TestData.ImportLogDateTime); }
/// <summary> /// Creates the import log. /// </summary> /// <param name="estateId">The estate identifier.</param> /// <param name="importLogDateTime">The import log date time.</param> public void CreateImportLog(Guid estateId, DateTime importLogDateTime) { // Silently handle a duplicate create if (this.IsCreated) { return; } ImportLogCreatedEvent importLogCreatedEvent = new ImportLogCreatedEvent(this.AggregateId, estateId, importLogDateTime); this.ApplyAndAppend(importLogCreatedEvent); }
public void FileProcessorDomainEventHandler_ImportLogCreatedEvent_EventIsHandled() { ImportLogCreatedEvent domainEvent = TestData.ImportLogCreatedEvent; Mock <IEstateReportingRepository> estateReportingRepository = new Mock <IEstateReportingRepository>(); FileProcessorDomainEventHandler eventHandler = new FileProcessorDomainEventHandler(estateReportingRepository.Object); Logger.Initialise(NullLogger.Instance); Should.NotThrow(async() => { await eventHandler.Handle(domainEvent, CancellationToken.None); }); }
/// <summary> /// Plays the event. /// </summary> /// <param name="domainEvent">The domain event.</param> private void PlayEvent(ImportLogCreatedEvent domainEvent) { this.IsCreated = true; this.EstateId = domainEvent.EstateId; this.ImportLogDateTime = domainEvent.ImportLogDateTime; }
/// <summary> /// Handles the specific domain event. /// </summary> /// <param name="domainEvent">The domain event.</param> /// <param name="cancellationToken">The cancellation token.</param> private async Task HandleSpecificDomainEvent(ImportLogCreatedEvent domainEvent, CancellationToken cancellationToken) { await this.EstateReportingRepository.AddFileImportLog(domainEvent, cancellationToken); }