public void DeletebyProduct_CallsDeleteMethodbyProductOnMockRepoWithCorrectId_ReturnsOkObject() { //Arrange long expectedId = 12; mockRepo.Setup(repo => repo.DeletebyProduct(expectedId)); //Act var result = controller.DeletebyProduct(expectedId); var resultObj = result as OkObjectResult; var model = resultObj.Value as String; //Assert mockRepo.Verify(repo => repo.DeletebyProduct(expectedId), Times.Once); Assert.IsType <OkObjectResult>(result); Assert.Equal(200, resultObj.StatusCode); Assert.Equal(model, $"Product at {expectedId} is deleted"); }