public void GetCreatedGames_WhenNoCreatedGameInRepository_ShouldReturnEmptyListOfGamesModel() { mock.Setup(g => g.Users.GetAll()).Returns(new User[] {new User() { SessionKey="10043IOvy7N9Bn9BDAk2mtT7ZcYKtZbBpdp00ZoIpJikyIJtef", Id=1 }}.AsQueryable()); mock.Setup(g => g.Games.GetAll()).Returns(new Game[] { }.AsQueryable()); GameService gameService = new GameService(mock.Object); IEnumerable<GameModel> createdGames = gameService.GetCreatedGames("10043IOvy7N9Bn9BDAk2mtT7ZcYKtZbBpdp00ZoIpJikyIJtef"); Assert.AreEqual(0, createdGames.Count()); }
public void GetCreatedGames_WhenASingleCreatedGameInRepositoryOnWhichCreatorIsUser_ShouldReturnSingleGameModel() { mock.Setup(g => g.Users.GetAll()).Returns(new User[] {new User() { SessionKey="10043IOvy7N9Bn9BDAk2mtT7ZcYKtZbBpdp00ZoIpJikyIJtef", Id=1 }}.AsQueryable()); mock.Setup(g => g.Games.GetAll()).Returns(new Game[] { new Game() { GameStatus="InProgress", RedUserId=1, Title="Title2", RedUser=new User(){Nickname="Kalin"} }, new Game() { GameStatus="Full", RedUserId=2, Title="Title2", RedUser=new User(){Nickname="Kalin"} } }.AsQueryable()); GameService gameService = new GameService(mock.Object); IEnumerable<GameModel> createdGames = gameService.GetCreatedGames("10043IOvy7N9Bn9BDAk2mtT7ZcYKtZbBpdp00ZoIpJikyIJtef"); Assert.AreEqual(1, createdGames.Count()); }