public SchemaDomainObject Delete(DeleteSchema command) { VerifyCreatedAndNotDeleted(); RaiseEvent(SimpleMapper.Map(command, new SchemaDeleted())); return(this); }
protected Task On(DeleteSchema command, CommandContext context) { return(handler.UpdateSyncedAsync <SchemaDomainObject>(context, s => { GuardSchema.CanDelete(s.Snapshot.SchemaDef, command); s.Delete(command); })); }
private async Task DeleteSchemaAsync(DeleteSchema commmand) { var schema = await GetSchemaInternalAsync(commmand.AppId.Id, commmand.SchemaId.Id); if (IsFound(schema, true)) { await Index(schema.AppId.Id).RemoveAsync(schema.Id); } }
private async Task DeleteSchemaAsync(DeleteSchema commmand) { var schemaId = commmand.SchemaId; var schema = await grainFactory.GetGrain <ISchemaGrain>(schemaId).GetStateAsync(); if (IsFound(schema.Value, true)) { await Index(schema.Value.AppId.Id).RemoveAsync(schemaId); } }
public async Task Delete_should_create_events_and_update_state() { var command = new DeleteSchema(); await ExecuteCreateAsync(); var result = await sut.ExecuteAsync(CreateCommand(command)); result.ShouldBeEquivalent(new EntitySavedResult(1)); Assert.True(sut.Snapshot.IsDeleted); LastEvents .ShouldHaveSameEvents( CreateEvent(new SchemaDeleted()) ); }
public async Task Should_remove_schema_from_index_on_delete_when_existed_before() { var schema = SetupSchema(); var command = new DeleteSchema { SchemaId = schemaId, AppId = appId }; var context = new CommandContext(command, commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => index.RemoveAsync(schema.Id)) .MustHaveHappened(); }
public async Task Should_remove_schema_from_index_if_deleted_and_exists() { var(schema, _) = SetupSchema(isDeleted: true); var command = new DeleteSchema { SchemaId = schemaId, AppId = appId }; var context = new CommandContext(command, commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => cache.RemoveAsync(schema.Id)) .MustHaveHappened(); }
public void Delete(DeleteSchema command) { RaiseEvent(SimpleMapper.Map(command, new SchemaDeleted())); }
public static void CanDelete(Schema schema, DeleteSchema command) { Guard.NotNull(command, nameof(command)); }
public void CanDelete_should_not_throw_exception() { var command = new DeleteSchema(); GuardSchema.CanDelete(schema_0, command); }
public void Delete(DeleteSchema command) { RaiseEvent(command, new SchemaDeleted()); }
private async Task OnDeleteAsync(DeleteSchema delete) { await InvalidateItAsync(delete.AppId.Id, delete.SchemaId.Id, delete.SchemaId.Name); await Cache(delete.AppId.Id).RemoveAsync(delete.SchemaId.Id); }
protected Task On(DeleteSchema command, CommandContext context) { return(handler.UpdateAsync <SchemaDomainObject>(context, s => s.Delete(command))); }
private void Delete(DeleteSchema command) { Raise(command, new SchemaDeleted()); }
public static void CanDelete(DeleteSchema command) { Guard.NotNull(command); }