public void GetListGameModels() { _mockGameRespository.GetGames().Returns(new List<Game> { new Game { GameId = 1, HomeTeamId = 2, AwayTeamId = 3, GameDateTime = new DateTime(2016, 4, 24, 15, 0, 0), HomeScore = 5, AwayScore = 2, Result = Result.HomeWin }, new Game { GameId = 2, HomeTeamId = 3, AwayTeamId = 4, GameDateTime = new DateTime(2016, 4, 30, 15, 0, 0), Result = Result.None }, new Game { GameId = 3, HomeTeamId = 4, AwayTeamId = 1, GameDateTime = new DateTime(2016, 4, 24, 15, 30, 0), Result = Result.None }, }); GameService gameService = new GameService(_mockGameRespository, _mockTeamRepository); var games = gameService.GetListGameModels(); Assert.That(games.Count, Is.EqualTo(3)); Assert.That(games[0].GameId, Is.EqualTo(1)); Assert.That(games[0].HomeTeamId, Is.EqualTo(2)); Assert.That(games[0].HomeTeam, Is.EqualTo("Team2")); Assert.That(games[0].AwayTeamId, Is.EqualTo(3)); Assert.That(games[0].AwayTeam, Is.EqualTo("Team3")); Assert.That(games[0].GameDateTime, Is.EqualTo(new DateTime(2016, 4, 24, 15, 0, 0))); Assert.That(games[0].Score, Is.EqualTo("5 - 2")); Assert.That(games[0].Result, Is.EqualTo(Result.HomeWin)); }
public void GetEditGameModel() { _mockGameRespository.GetGame(1).Returns(new Game { GameId = 1, HomeTeamId = 2, AwayTeamId = 3, GameDateTime = new DateTime(2016, 4, 24, 15, 0, 0) }); GameService gameService = new GameService(_mockGameRespository, _mockTeamRepository); EditGameModel editGameModel = gameService.GetEditGameModel(1); Assert.That(editGameModel.Teams.Count, Is.EqualTo(4)); Assert.That(editGameModel.GameId, Is.EqualTo(1)); Assert.That(editGameModel.HomeTeamId, Is.EqualTo(2)); Assert.That(editGameModel.HomeScore, Is.Null); Assert.That(editGameModel.AwayTeamId, Is.EqualTo(3)); Assert.That(editGameModel.AwayScore, Is.Null); Assert.That(editGameModel.GameDate, Is.EqualTo(new DateTime(2016, 4, 24, 15, 0, 0))); }