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 Handle(FileCreatedEvent message) { //ignore changes to files in .git repository //seems to happen if you are running github 4 windows and //looking at a repository while you edit a file from //that repository in markpad if (message.FullPath.Contains(".git\\") || message.FullPath.Contains(".git/")) { return; } if (Path == System.IO.Path.GetDirectoryName(message.FullPath)) { var newItem = new FileSystemSiteItem(EventAggregator, fileSystem, message.FullPath); for (int i = 0; i < Children.Count; i++) { if (String.Compare(Children[i].Name, newItem.Name, StringComparison.Ordinal) < 0) { continue; } Children.Insert(i, newItem); break; } } }
/// <summary> /// Uploads the file. /// </summary> /// <param name="fileImportLogId">The file import log identifier.</param> /// <param name="estateId">The estate identifier.</param> /// <param name="merchantId">The merchant identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="fileProfileId">The file profile identifier.</param> /// <param name="fileLocation">The file location.</param> /// <param name="fileReceivedDateTime">The file received date time.</param> /// <exception cref="InvalidOperationException">File Id {this.AggregateId} has already been created</exception> /// <exception cref="System.InvalidOperationException">File Id {this.AggregateId} has already been uploaded</exception> public void CreateFile(Guid fileImportLogId, Guid estateId, Guid merchantId, Guid userId, Guid fileProfileId, String fileLocation, DateTime fileReceivedDateTime) { if (this.IsCreated) { return; } FileCreatedEvent fileCreatedEvent = new FileCreatedEvent(this.AggregateId, fileImportLogId, estateId, merchantId, userId, fileProfileId, fileLocation, fileReceivedDateTime); this.ApplyAndAppend(fileCreatedEvent); }
/// <summary> /// Plays the event. /// </summary> /// <param name="domainEvent">The domain event.</param> private void PlayEvent(FileCreatedEvent domainEvent) { this.IsCreated = true; this.EstateId = domainEvent.EstateId; this.MerchantId = domainEvent.MerchantId; this.FileProfileId = domainEvent.FileProfileId; this.UserId = domainEvent.UserId; this.FileLocation = domainEvent.FileLocation; this.FileImportLogId = domainEvent.FileImportLogId; this.FileReceivedDateTime = domainEvent.FileReceivedDateTime; }
public void FileProcessorDomainEventHandler_FileCreatedEvent_EventIsHandled() { FileCreatedEvent domainEvent = TestData.FileCreatedEvent; 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); }); }
public void Handle(FileCreatedEvent message) { if (Path == System.IO.Path.GetDirectoryName(message.FullPath)) { var newItem = new FileSystemSiteItem(EventAggregator, fileSystem, message.FullPath); for (int i = 0; i < Children.Count; i++) { if (String.Compare(Children[i].Name, newItem.Name, StringComparison.Ordinal) < 0) { continue; } Children.Insert(i, newItem); break; } } }
public void HandleChange(FileSystemEventArgs args) { try { switch (args.ChangeType) { case WatcherChangeTypes.Created: { if (File.Exists(args.FullPath)) { this.Files.Add(new LocalFile(args.FullPath, this.FolderPath)); var @event = new FileCreatedEvent(args.FullPath, this.FolderName); this.eventListener.On(@event); Console.WriteLine($"Created: {args.FullPath}"); } break; } case WatcherChangeTypes.Deleted: { var toDelete = this.Files.FirstOrDefault(it => string.Equals(it.AbsolutePath, args.FullPath, StringComparison.InvariantCultureIgnoreCase)); this.Files.Remove(toDelete); var @event = new FileDeletedEvent(args.FullPath, this.FolderName); this.eventListener.On(@event); Console.WriteLine($"Deleted: {args.FullPath}"); break; } case WatcherChangeTypes.Changed: { if (File.Exists(args.FullPath)) { var @event = new FileChangedEvent(args.FullPath, this.FolderName); this.eventListener.On(@event); Console.WriteLine($"Changed: {args.FullPath}"); } break; } } } catch (Exception exception) { Console.WriteLine(exception.ToString()); } }
public void On(FileCreatedEvent @event) { string source = @event.Path; string target; Operation operation; if (@event.Sender == this.encryptedFolder.FolderName) { target = this.decryptedFolder.GetAbsolutePath(this.encryptedFolder.GetRelativePath(source)); operation = new DecryptFileOperation(source, target, this.credentials); } else { target = this.encryptedFolder.GetAbsolutePath(this.decryptedFolder.GetRelativePath(source)); operation = new EncryptFileOperation(source, target, this.credentials); } this.operations.Enqueue(operation); }
public void FileCreatedEvent_CanBeCreated_IsCreated() { FileCreatedEvent fileCreatedEvent = new FileCreatedEvent(TestData.FileId, TestData.FileImportLogId, TestData.EstateId, TestData.MerchantId, TestData.UserId, TestData.FileProfileId, TestData.FileLocation, TestData.FileUploadedDateTime); fileCreatedEvent.FileId.ShouldBe(TestData.FileId); fileCreatedEvent.FileImportLogId.ShouldBe(TestData.FileImportLogId); fileCreatedEvent.EstateId.ShouldBe(TestData.EstateId); fileCreatedEvent.MerchantId.ShouldBe(TestData.MerchantId); fileCreatedEvent.UserId.ShouldBe(TestData.UserId); fileCreatedEvent.FileProfileId.ShouldBe(TestData.FileProfileId); fileCreatedEvent.FileLocation.ShouldBe(TestData.FileLocation); fileCreatedEvent.FileReceivedDateTime.ShouldBe(TestData.FileUploadedDateTime); }
/// <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(FileCreatedEvent domainEvent, CancellationToken cancellationToken) { await this.EstateReportingRepository.AddFile(domainEvent, cancellationToken); }
private void OnCreated(string name, string path) { FileCreatedEvent?.Invoke(this, new FileCreatedEventArgs { Name = name, FilePath = path }); }