public async Task <IActionResult> UnpublishSchema(string app, string schema) { var command = new UnpublishSchema(); var response = await InvokeCommandAsync(command); return(Ok(response)); }
public SchemaDomainObject Unpublish(UnpublishSchema command) { VerifyCreatedAndNotDeleted(); RaiseEvent(SimpleMapper.Map(command, new SchemaUnpublished())); return(this); }
public void CanUnpublish_should_not_throw_exception_if_already_published() { var command = new UnpublishSchema(); var schema_1 = schema_0.Publish(); GuardSchema.CanUnpublish(schema_1, command); }
public static void CanUnpublish(Schema schema, UnpublishSchema command) { Guard.NotNull(command, nameof(command)); if (!schema.IsPublished) { throw new DomainException("Schema is not published."); } }
protected Task On(UnpublishSchema command, CommandContext context) { return(handler.UpdateSyncedAsync <SchemaDomainObject>(context, s => { GuardSchema.CanUnpublish(s.Snapshot.SchemaDef, command); s.Unpublish(command); })); }
public SchemaDomainObject Unpublish(UnpublishSchema command) { Guard.NotNull(command, nameof(command)); VerifyCreatedAndNotDeleted(); SchemaGuard.GuardCanUnpublish(schema); RaiseEvent(SimpleMapper.Map(command, new SchemaUnpublished())); return(this); }
public async Task Unpublish_should_create_events_and_update_state() { var command = new UnpublishSchema(); await ExecuteCreateAsync(); await ExecutePublishAsync(); var result = await sut.ExecuteAsync(CreateCommand(command)); result.ShouldBeEquivalent(new EntitySavedResult(2)); Assert.False(sut.Snapshot.SchemaDef.IsPublished); LastEvents .ShouldHaveSameEvents( CreateEvent(new SchemaUnpublished()) ); }
public async Task Unpublish_should_create_events_and_update_published_flag() { var command = new UnpublishSchema(); await ExecuteCreateAsync(); await ExecutePublishAsync(); var result = await PublishIdempotentAsync(command); result.ShouldBeEquivalent(sut.Snapshot); Assert.False(sut.Snapshot.SchemaDef.IsPublished); LastEvents .ShouldHaveSameEvents( CreateEvent(new SchemaUnpublished()) ); }
public void Unpublish(UnpublishSchema command) { RaiseEvent(SimpleMapper.Map(command, new SchemaUnpublished())); }
public static void CanUnpublish(UnpublishSchema command) { Guard.NotNull(command, nameof(command)); }
public void CanUnpublish_should_throw_exception_if_already_unpublished() { var command = new UnpublishSchema(); Assert.Throws <DomainException>(() => GuardSchema.CanUnpublish(schema_0, command)); }
public void Unpublish(UnpublishSchema command) { RaiseEvent(command, new SchemaUnpublished()); }
protected Task On(UnpublishSchema command, CommandContext context) { return(handler.UpdateAsync <SchemaDomainObject>(context, s => s.Unpublish(command))); }
private void Unpublish(UnpublishSchema command) { Raise(command, new SchemaUnpublished()); }