public async Task Handle_PropertyDefinitionModifiedEvent_UpdatesProperty() { // arrange var initialProject = this.CreateProject(); var initialProperty = initialProject.Entities.First().Properties.First(); var message = new PropertyDefinitionModified { Id = initialProject.Id, PropertyId = initialProperty.Id, Name = "New property name", Description = "New property description", PropertyType = "Zuehlke.Eacm.String", Version = 2, TimeStamp = DateTimeOffset.Now }; var target = new ReadModelEventHandler(this.context.DbContext, this.context.Mapper); // act await target.Handle(message); // assert var property = this.context.DbContext.Properties.FirstOrDefault(p => p.Id == message.PropertyId); Assert.NotNull(property); Assert.Equal(message.Name, property.Name); Assert.Equal(message.Description, property.Description); Assert.Equal(message.PropertyType, property.PropertyType); }
private void OnPropertyDefinitionModified(PropertyDefinitionModified e) { if (this.currentPropertyType != e.PropertyType) { this.currentPropertyType = this.Property.PropertyType; this.Value = null; } }
public async Task Handle(PropertyDefinitionModified message) { message.ArgumentNotNull(nameof(message)); await this.UpdateEntityAsync <PropertyDefinitionModified, ConfigurationProperty>(message, m => m.PropertyId); await this.dbContext.SaveChangesAsync(); }
public void ModifyPropertyDefinition(Guid propertyId, string name, string description, string propertyType) { name.ArgumentNotNullOrEmpty(nameof(name)); description.ArgumentNotNull(nameof(description)); propertyType.ArgumentNotNullOrEmpty(nameof(propertyType)); // the property gets fetched to assert its existence. PropertyDefinition property = this.GetPropertyDefinition(propertyId); var e = new PropertyDefinitionModified { Id = Id, PropertyId = property.Id, Name = name, Description = description, PropertyType = propertyType }; this.ApplyChange(e); }
private void Apply(PropertyDefinitionModified e) { this.eventAggregator.Publish(e); }
//// public EntityDefinition Reference { get; private set; } private void OnPropertyDefinitionModified(PropertyDefinitionModified e) { this.Name = e.Name; this.Description = e.Description; this.PropertyType = e.PropertyType; }