public async Task TestDeleteCatalogSuccess() { //Should remove the catalog var result = await controller.DeleteCatalog(2); Assert.IsType <OkObjectResult>(result); OkObjectResult new_res = (OkObjectResult)result; CatalogDTO new_dto = (CatalogDTO)new_res.Value; //Information inside the elimanated CatalogDTO should be equivalent to the requested catalog for deletion Assert.Equal("Second_Test_Catalog", new_dto.CatalogName); Assert.Equal("This is another mock Catalog", new_dto.CatalogDescription); Assert.Equal("06/01/2019", new_dto.Date); Assert.True(2 == new_dto.CatalogId); //Should not be possible to get the catalog once its deleted var result2 = await controller.GetCatalog(2); Assert.IsType <NotFoundResult>(result2); }
public async void DeleteCatalog(int id) { var res = await CatalogController.DeleteCatalog(id); if (res == null || !res.IsSuccess) { Notification.Error(HandleError <CatalogErrorMessage> .GetErrorString(res.Messages)); } else { Notification.Success("Success"); renderCatalogs(); } }