public static void CanConfigureUIFields(ConfigureUIFields command, Schema schema) { Guard.NotNull(command, nameof(command)); Validate.It(e => { ValidateFieldNames(schema, command.FieldsInLists, nameof(command.FieldsInLists), e, IsMetaField); ValidateFieldNames(schema, command.FieldsInReferences, nameof(command.FieldsInReferences), e, IsNotAllowed); }); }
public static void CanConfigureUIFields(Schema schema, ConfigureUIFields command) { Guard.NotNull(command); Validate.It(() => "Cannot configure UI fields.", e => { ValidateFieldNames(schema, command.FieldsInLists, nameof(command.FieldsInLists), e); ValidateFieldNames(schema, command.FieldsInReferences, nameof(command.FieldsInReferences), e); }); }
public ConfigureUIFields ToCommand() { var command = new ConfigureUIFields(); if (FieldsInLists != null) { command.FieldsInLists = new FieldNames(FieldsInLists); } if (FieldsInReferences != null) { command.FieldsInReferences = new FieldNames(FieldsInReferences); } return(command); }
public async Task ConfigureUIFields_should_create_events_for_reference_fields() { var command = new ConfigureUIFields { FieldsInReferences = new FieldNames(fieldName) }; await ExecuteCreateAsync(); await ExecuteAddFieldAsync(fieldName); var result = await PublishIdempotentAsync(command); result.ShouldBeEquivalent2(sut.Snapshot); Assert.Equal(command.FieldsInReferences, sut.Snapshot.SchemaDef.FieldsInReferences); LastEvents .ShouldHaveSameEvents( CreateEvent(new SchemaUIFieldsConfigured { FieldsInReferences = command.FieldsInReferences }) ); }
public async Task ConfigureUIFields_should_create_events_for_list_fields() { var command = new ConfigureUIFields { FieldsInLists = new FieldNames(fieldName) }; await ExecuteCreateAsync(); await ExecuteAddFieldAsync(fieldName); var result = await sut.ExecuteAsync(CreateCommand(command)); result.ShouldBeEquivalent(sut.Snapshot); Assert.Equal(command.FieldsInLists, sut.Snapshot.SchemaDef.FieldsInLists); LastEvents .ShouldHaveSameEvents( CreateEvent(new SchemaUIFieldsConfigured { FieldsInLists = command.FieldsInLists }) ); }
public void ConfigureUIFields(ConfigureUIFields command) { RaiseEvent(command, new SchemaUIFieldsConfigured()); }
private void ConfigureUIFields(ConfigureUIFields command) { Raise(command, new SchemaUIFieldsConfigured()); }