public async Task Search_plant_listing_success(string keyword, int?categoryId, int pageSize, int pageIndex, int expectedCount) { //Arrange var plantDetailsContext = new PlantListingContext(_dbOptions); //Act var plantDetailsController = new PlantListingController(plantDetailsContext, _mockPlantImageService.Object); var actionResult = await plantDetailsController.SearchPlantListing(keyword, categoryId, pageSize, pageIndex); //Assert Assert.IsType <ActionResult <PaginatedItemsViewModel <PlantDetailsViewModel> > >(actionResult); Assert.Equal(expectedCount, actionResult.Value.Data.Count()); }
public async Task Search_plant_listing_bad_request_response() { //Arrange var plantDetailsContext = new PlantListingContext(_dbOptions); //Act var plantDetailsController = new PlantListingController(plantDetailsContext, _mockPlantImageService.Object); var actionResult = await plantDetailsController.SearchPlantListing(null); //Assert Assert.IsType <ActionResult <PaginatedItemsViewModel <PlantDetailsViewModel> > >(actionResult); Assert.IsType <BadRequestObjectResult>(actionResult.Result); }