public void TeamController_Search_Post_ModelStateInvalid()
        {
            //Arrange
            var teamResults = new List <Team>()
            {
                new Team()
                {
                    ID = 1
                }
            };

            var mockTeamService = new MockTeamService().MockSearch(teamResults);

            var controller = new TeamController(mockTeamService.Object);

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

            //Act
            var result = controller.Search(new TeamSearch());

            //Assert
            Assert.IsAssignableFrom <RedirectToActionResult>(result);
            mockTeamService.VerifySearch(Times.Never());

            var redirectToAction = (RedirectToActionResult)result;

            Assert.Equal("Search", redirectToAction.ActionName);
        }
        public void TeamController_Search_Post_NoResults()
        {
            //Arrange
            var mockTeamService = new MockTeamService().MockSearch(new List <Team>());

            var controller = new TeamController(mockTeamService.Object);

            //Act
            var result = controller.Search(new TeamSearch());

            //Assert
            Assert.IsAssignableFrom <RedirectToActionResult>(result);
            mockTeamService.VerifySearch(Times.Once());
        }
        public void TeamController_Search_Post_Valid()
        {
            //Arrange
            var teamResults = new List <Team>()
            {
                new Team()
                {
                    ID = 1
                }
            };
            var mockTeamService = new MockTeamService().MockSearch(teamResults);

            var controller = new TeamController(mockTeamService.Object);

            //Act
            var result = controller.Search(new TeamSearch());

            //Assert
            Assert.IsAssignableFrom <ViewResult>(result);
            mockTeamService.VerifySearch(Times.Once());
        }