public void Test_GetAllCatalogue() { List <CatalogueModel> catalogueList = new List <CatalogueModel>(); var taskDecorator = Task.FromResult(catalogueList); _mockRetrieveCatalogueRepo.Setup(x => x.GetAllCatalogues()).Returns(taskDecorator); var result = _retrieveCatalogue.GetAllCatalogue(); Assert.IsTrue(result is Task <List <CatalogueModel> >); }
public async Task <IActionResult> GetAllCatalogue() { try { List <CatalogueModel> catalogues = await _retrieveCatalogue.GetAllCatalogue(); if (catalogues != null) { return(Ok(catalogues)); } else { return(StatusCode(404)); } } catch (Exception e) { return(StatusCode(500, e.Message)); } }