Exemplo n.º 1
0
        private async Task <object?> PublishAsync(SchemaCommand command)
        {
            var result = await sut.ExecuteAsync(CreateCommand(command));

            return(result.Value);
        }
Exemplo n.º 2
0
        public async Task Create_should_create_schema_and_create_events()
        {
            var properties = new SchemaProperties();

            var command = new CreateSchema {
                Name = SchemaName, SchemaId = SchemaId, Properties = properties, IsSingleton = true
            };

            var result = await sut.ExecuteAsync(CreateCommand(command));

            result.ShouldBeEquivalent(sut.Snapshot);

            Assert.Equal(AppId, sut.Snapshot.AppId.Id);

            Assert.Equal(SchemaName, sut.Snapshot.SchemaDef.Name);
            Assert.Equal(SchemaName, sut.Snapshot.SchemaDef.Name);
            Assert.True(sut.Snapshot.SchemaDef.IsSingleton);

            LastEvents
            .ShouldHaveSameEvents(
                CreateEvent(new SchemaCreated {
                Schema = new Schema(command.Name, command.Properties, command.IsSingleton)
            })
                );
        }