private void OnPropertyDefinitionDeleted(PropertyDefinitionDeleted e) { if (this.values.ContainsKey(e.PropertyId)) { this.values.Remove(e.PropertyId); } }
public async Task Handle_PropertyDefinitionDeletedEvent_UpdatesProjectVersionTracking() { // arrange var initialProject = this.CreateProject(); var initialProperty = initialProject.Entities.First().Properties.First(); var message = new PropertyDefinitionDeleted { Id = initialProject.Id, PropertyId = initialProperty.Id, Version = 2, TimeStamp = DateTimeOffset.Now }; var target = new ReadModelEventHandler(this.context.DbContext, this.context.Mapper); // act await target.Handle(message); // assert var project = this.context.DbContext.Projects.First(p => p.Id == message.Id); Assert.Equal(message.Id, project.Id); Assert.Equal(message.Version, project.Version); Assert.Equal(message.TimeStamp, project.TimeStamp); }
public async Task Handle(PropertyDefinitionDeleted message) { message.ArgumentNotNull(nameof(message)); await this.DeleteEntityAsync <PropertyDefinitionDeleted, ConfigurationProperty>(message, m => m.PropertyId); await this.dbContext.SaveChangesAsync(); }
private void OnPropertyDefinitionDeletded(PropertyDefinitionDeleted e) { PropertyDefinition property = this.properties.FirstOrDefault(i => i.Id == e.PropertyId); if (property != null) { this.properties.Remove(property); } }
public void DeletePropertyDefinition(Guid propertyId) { var e = new PropertyDefinitionDeleted { Id = this.Id, PropertyId = propertyId }; this.ApplyChange(e); }
public async Task Handle_PropertyDefinitionDeletedEvent_DeletesValues() { // arrange var initialProject = this.CreateProject(); var initialProperty = initialProject.Entities.First().Properties.First(); var message = new PropertyDefinitionDeleted { Id = initialProject.Id, PropertyId = initialProperty.Id, Version = 2, TimeStamp = DateTimeOffset.Now }; var target = new ReadModelEventHandler(this.context.DbContext, this.context.Mapper); // act await target.Handle(message); // assert var values = this.context.DbContext.Values.Where(v => v.PropertyId == initialProperty.Id); Assert.Empty(values); }
private void Apply(PropertyDefinitionDeleted e) { this.eventAggregator.Publish(e); }