public void Test_GetAll_ReturnsAllGames() { var items = Enumerable.Range(1, 20).Select(i => new Game() { Id = i, Name = "game " + i }).ToList(); _mockGameStorage.GetAll().Returns(items); var result = Controller.GetAll(); Assert.NotNull(result); Assert.AreEqual(items.Count, result.Count()); foreach (var item in items) { Assert.IsTrue( result.Any(actual => actual.Id == item.Id && actual.Name == item.Name)); } }
public IEnumerable <GameModel> GetAll() { return(_gameStorage.GetAll().Select(CreateGameModel).ToList()); }