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



            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.AddSport(It.IsAny <Sport>())).Throws <Exception>();

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

            //Assert
            Assert.True(result.ViewName == "Add");
        }
        public void TestAddSportReturnsToIndexAction()
        {
            //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.AddSport(It.IsAny <Sport>())).Throws <Exception>();

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

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