예제 #1
0
        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);
            });
        }
예제 #2
0
        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);
            });
        }
예제 #3
0
        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);
        }
예제 #4
0
        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
            })
                );
        }
예제 #5
0
        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
            })
                );
        }
예제 #6
0
 public void ConfigureUIFields(ConfigureUIFields command)
 {
     RaiseEvent(command, new SchemaUIFieldsConfigured());
 }
예제 #7
0
 private void ConfigureUIFields(ConfigureUIFields command)
 {
     Raise(command, new SchemaUIFieldsConfigured());
 }