public void FileProcessingCompletedEvent_CanBeCreated_IsCreated() { FileProcessingCompletedEvent fileProcessingCompletedEvent = new FileProcessingCompletedEvent(TestData.FileId, TestData.EstateId, TestData.ProcessingCompletedDateTime); fileProcessingCompletedEvent.FileId.ShouldBe(TestData.FileId); fileProcessingCompletedEvent.EstateId.ShouldBe(TestData.EstateId); fileProcessingCompletedEvent.ProcessingCompletedDateTime.ShouldBe(TestData.ProcessingCompletedDateTime); }
/// <summary> /// Completeds the checks. /// </summary> private void CompletedChecks() { if (this.FileLines.Any(f => f.ProcessingResult == ProcessingResult.NotProcessed) == false) { // All lines have been processed, write out a completed event FileProcessingCompletedEvent fileProcessingCompletedEvent = new FileProcessingCompletedEvent(this.AggregateId, this.EstateId, DateTime.Now); this.ApplyAndAppend(fileProcessingCompletedEvent); } }
public void FileProcessorDomainEventHandler_FileProcessingCompletedEvent_EventIsHandled() { FileProcessingCompletedEvent domainEvent = TestData.FileProcessingCompletedEvent; 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(FileProcessingCompletedEvent domainEvent) { this.IsCompleted = true; }
/// <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(FileProcessingCompletedEvent domainEvent, CancellationToken cancellationToken) { await this.EstateReportingRepository.UpdateFileAsComplete(domainEvent, cancellationToken); }