public void Test_GetAll_ReturnsAllGames() { var items = Enumerable.Range(1, 20).Select(CreateSession).ToList(); _mockGameSessionStorage.GetAll().Returns(items); var result = Controller.GetAll(); Assert.NotNull(result); Assert.AreEqual(items.Count, result.Count()); foreach (var item in items) { var match = result.FirstOrDefault(r => r.Id == item.Id); Assert.NotNull(match); Assert.AreEqual(item.GameName, match.GameName); Assert.NotNull(match.Errands); Assert.AreEqual(item.Errands.Count, match.Errands.Count()); Assert.NotNull(match.Players); Assert.AreEqual(item.Players.Count, match.Players.Count()); foreach (var player in item.Players) { Assert.IsTrue(match.Players.Any(pl => pl == player)); } } }
public IEnumerable <GameSessionModel> GetAll() { return(_gameSessionStorage.GetAll().Select(CreateGameSessionModel).ToList()); }