public async Task Get_Returns_NotFoundResult_When_WorkoutIsNotFound()
            {
                // Arrange
                const int id = 1;

                WorkoutServiceMock
                .Setup(x => x.ReadOneAsync(id))
                .ReturnsAsync(default(WorkoutViewModel));

                // Act
                var result = await ControllerUnderTest.Edit(id);

                // Assert
                Assert.IsType <NotFoundResult>(result);
            }
            public async Task Post_Returns_View_Result_When_ModelStateIsInvalid()
            {
                // Arrange
                const int id = 1;
                var       expectedWorkout = new WorkoutViewModel {
                    Name = "Test workout 01", Id = id
                };

                ControllerUnderTest.ModelState.AddModelError("Id", "Some error");

                // Act
                var result = await ControllerUnderTest.Edit(id, expectedWorkout);

                // Assert
                var viewResult = Assert.IsType <ViewResult>(result);

                Assert.IsType <WorkoutViewModel>(viewResult.Model);
            }
            public async Task Get_Returns_ViewResult_With_Workout_When_WorkoutIsFound()
            {
                // Arrange
                const int id = 1;
                var       expectedWorkout = new WorkoutViewModel {
                    Name = "Test workout 01", Id = id
                };

                WorkoutServiceMock
                .Setup(x => x.ReadOneAsync(id))
                .ReturnsAsync(expectedWorkout);

                // Act
                var result = await ControllerUnderTest.Edit(id);

                // Assert
                var viewResult = Assert.IsType <ViewResult>(result);

                Assert.Same(expectedWorkout, viewResult.Model);
            }
            public async Task Post_Returns_RedirectToActionResult_When_ModelStateIsValid()
            {
                // Arrange
                const int id = 1;
                var       expectedWorkout = new WorkoutViewModel {
                    Name = "Test workout 01", Id = id
                };
                const string expectedActionName = nameof(WorkoutsController.Index);

                WorkoutServiceMock
                .Setup(x => x.UpdateAsync(id, expectedWorkout))
                .Returns(Task.CompletedTask);

                // Act
                var result = await ControllerUnderTest.Edit(id, expectedWorkout);

                // Assert
                var redirectToActionResult = Assert.IsType <RedirectToActionResult>(result);

                Assert.Equal(expectedActionName, redirectToActionResult.ActionName);
            }