public void GetAll_Returns_Status_500_When_Service_Returns_Null() { A.CallTo(() => _service.GetAll(_queryWithDefaultValues)).Returns(null); var result = _controller.GetAll(_queryWithDefaultValues); var status = result.Result as StatusCodeResult; Assert.Equal((int)HttpStatusCode.InternalServerError, status.StatusCode); }
public void TestAll() { IMetadataService service = UnitOfWork.GetService <IMetadataService>(); IServiceQueryResultList <MetadataData> result = service.GetAll(); List <MetadataData> list = result.DataList.ToList(); if (list != null) { } }
public ActionResult <Response> GetAll([FromQuery] BaseListQuery query) { var meta = _service.GetAll(query); if (meta != null) { return(Ok(meta)); } return(InternalServerError()); }
internal List <TDto> RetrieveAll <TDto>(IDataConverter <MetadataData, TDto> converter) where TDto : class { ArgumentValidator.IsNotNull("converter", converter); IMetadataService service = UnitOfWork.GetService <IMetadataService>(); var query = service.GetAll(); if (query.HasResult) { return(query.DataToDtoList(converter).ToList()); } return(null); }