DigitalData.StaffDBServer/Scripts/Core/EntityController_test.tmpl

26 lines
836 B
Cheetah

[Fact]
public async Task Check_Get_entity_Controller()
{
Shared_Test_Config.Init_Webapi_Context();
try
{
int entityId = 1;
_entity_Repository repository = new _entity_Repository();
_entity_Controller controller = new _entity_Controller(repository);
dynamic result = await controller.GetEntityAsync(entityId);
Assert.NotNull(result);
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
var entity = result.Result.Value;
Assert.NotNull(entity);
if (entityId > 0) Assert.Equal(entityId, entity._entity_Id);
}
catch (Exception ex)
{
throw ex;
}
}