public void ControllerReturnsCorrectViewWhenCreatingGame() { var sut = new GamesController(new MockGamesRepository()); var result = sut.Create() as ViewResult; Assert.NotNull(result); Assert.Equal("", result.ViewName); }
public void ControllerSavesGame(string gameName, string owner, GameType gameType) { var mockGamesRepository = new MockGamesRepository(); var sut = new GamesController(mockGamesRepository); sut.Create(gameName, gameType, owner); Assert.Equal(1, mockGamesRepository.SaveCallCount); Assert.Equal(gameName, mockGamesRepository.LastGame.Name); }
public void ControllerReturnsCorrectMessageWhenCreatingAGame(string gameName, string owner, GameType gameType) { var sut = new GamesController(new MockGamesRepository()); var result = sut.Create(gameName, gameType, owner) as ViewResult; var expectedMessage = "The game \"" + gameName + "\" has been created."; Assert.NotNull(result); Assert.Equal("", result.ViewName); Assert.Equal(expectedMessage, result.Model); }