public void SubmitDelete_NonExistingItem_Returns404NotFound()
        {
            // Arrange
            var fruitRepositoryMock = new Mock <IFruitRepository>();
            var controller          = new FruitsController(fruitRepositoryMock.Object);

            // Act
            var result = controller.DeleteConfirmed(1).Result;

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }
        public void SubmitDelete_ExistingItem_RedirectsToIndex()
        {
            // Arrange
            var fruitRepositoryMock = new Mock <IFruitRepository>();
            var controller          = new FruitsController(fruitRepositoryMock.Object);

            fruitRepositoryMock.Setup(x => x.GetById(1)).ReturnsAsync(new Fruit
            {
                Id          = 1,
                Color       = Color.Red,
                Name        = "Apple",
                Price       = 2.99m,
                Rating      = 5,
                Description = "An apple",
                Image       = "apple.jpeg"
            });

            // Act
            var result = controller.DeleteConfirmed(1).Result;

            // Assert
            Assert.IsType <RedirectToActionResult>(result);
        }