public void entity_should_return_invalid_properties(DataEntityPayload entity) { var response = callCreateEntity(entity); Assert.NotNull(response.Value); Assert.Equal("Properties entity invalid.", response.Value.message); }
public void entity_should_return_error_pk_in_use(DataEntityPayload entity) { var response = callCreateEntity(entity); Assert.NotNull(response.Value); Assert.Equal("PK already in use.", response.Value.message); }
public void entity_should_return_table_not_found(DataEntityPayload entity) { var response = callCreateEntity(entity); Assert.NotNull(response.Value); Assert.Equal($"Table {entity.tableKey} not found.", response.Value.message); }
public void entity_should_return_table_not_contain(DataEntityPayload entity) { var response = callCreateEntity(entity); Assert.NotNull(response.Value); Assert.Equal($"Database {entity.databaseKey} not contain table {entity.tableKey}", response.Value.message); }
public void entity_should_return_error_reference_not_found(DataEntityPayload entity) { var response = callCreateEntity(entity); JObject parsedObject = JObject.Parse(JsonSerializer.Serialize(entity.entity)); var objectReference = parsedObject.Properties().Where(x => x.Value.ToString().Split(".").Count() == 3).FirstOrDefault(); Assert.NotNull(response.Value); Assert.NotNull(objectReference); Assert.Equal($"Reference attribute {objectReference.Name}: { objectReference.Value } notfound", response.Value.message); }
public void entity_should_create(DataEntityPayload entity) { var response = callCreateEntity(entity); Assert.NotNull(response.Value); var entitiesParsed = JArray.Parse(JsonSerializer.Serialize(response.Value.content.entities ?? new List <dynamic>())); Assert.True(entitiesParsed.Count() > 0); Assert.Equal(response.Value.content.id, entity.tableKey); }
private ActionResult <APIResponse <TableViewModel> > callCreateEntity(DataEntityPayload payload) { return(this._controller.entity(payload)); }
public ActionResult <APIResponse <TableViewModel> > entity(DataEntityPayload payload) { return(base.BeginCommonHandler <TableViewModel>(response => { response.content = _mapper.Map <TableViewModel>(_databaseService.addEntity(payload.databaseKey, payload.tableKey, payload.entity)); })); }