public void PlayerController_League_Valid() { //Arrange var mockPlayers = new List <Player>() { new Player() { ID = 1 } }; var mockLeagueService = new MockLeagueService().MockIsValid(true); var mockPlayerService = new MockPlayerService().MockGetForLeague(mockPlayers); var controller = new PlayerController(mockLeagueService.Object, mockPlayerService.Object); //Act var result = controller.League(1); //Assert Assert.IsAssignableFrom <ViewResult>(result); mockPlayerService.VerifyGetForLeague(Times.Once()); mockLeagueService.VerifyIsValid(Times.Once()); }
public void PlayerController_League_Invalid() { //Arrange var mockLeagueService = new MockLeagueService().MockIsValid(false); var mockPlayerService = new MockPlayerService().MockGetForLeague(new List <Player>()); var controller = new PlayerController(mockLeagueService.Object, mockPlayerService.Object); //Act var result = controller.League(1); //Assert Assert.IsAssignableFrom <RedirectToActionResult>(result); mockPlayerService.VerifyGetForLeague(Times.Never()); mockLeagueService.VerifyIsValid(Times.Once()); }