public void TestUpdateInvalidSporReturnsCurrentView()
        {
            //Arrange
            var dummysport = new Sport
            {
                Name = "KongBall",
            };

            var sports = new[]
            {
                new Sport {
                    Name = "Voetbal"
                },
                new Sport {
                    Name = "Basketbal"
                },
                new Sport {
                    Name = "Hockey"
                },
                new Sport {
                    Name = "Volleybal"
                }
            };

            var mockManager  = new Mock <ISportManager>();
            var mockTempData = new Mock <ITempDataDictionary>();
            var controller   = new SportController(mockManager.Object)
            {
                TempData = mockTempData.Object
            };

            controller.ModelState.AddModelError("", "");

            mockManager.Setup(x => x.UpdateSport(It.IsAny <Sport>())).Throws <Exception>();

            //Act
            var result = (ViewResult)controller.Update(dummysport);

            //Assert
            Assert.True(result.ViewName == "Update");
        }
        public void TestUpdateSportReturnsToIndexMethod()
        {
            //Arrange
            var dummysport = new Sport
            {
                Name = "KongBall",
            };

            var sports = new[]
            {
                new Sport {
                    Name = "Voetbal"
                },
                new Sport {
                    Name = "Basketbal"
                },
                new Sport {
                    Name = "Hockey"
                },
                new Sport {
                    Name = "Volleybal"
                }
            };

            var mockManager  = new Mock <ISportManager>();
            var mockTempData = new Mock <ITempDataDictionary>();
            var controller   = new SportController(mockManager.Object)
            {
                TempData = mockTempData.Object
            };

            mockManager.Setup(x => x.UpdateSport(It.IsAny <Sport>())).Throws <Exception>();

            //Act
            var result = controller.Update(dummysport);

            //Assert
            Assert.IsType(typeof(RedirectToActionResult), result);
        }