public void TestLoadGameIdOutOfRange() { var gameSource = new GameSourceFromResources(new BinaryFormatter()); int maxId = gameSource.GetMetaInfoOfAllGames().Select(m => m.ID).Max(); Assert.ThrowsException <ArgumentOutOfRangeException>(() => gameSource.GetGame(maxId + 1)); }
public void TestCorrectMetaInfo() { var serializer = new BinaryFormatter(); var gameSource = new GameSourceFromResources(serializer); var expectedGames = GetAllGames(serializer); Assert.AreEqual(expectedGames.Count(), gameSource.GetMetaInfoOfAllGames().Count()); foreach (var actualMetaInfo in gameSource.GetMetaInfoOfAllGames()) { var expectedGame = expectedGames.FirstOrDefault(g => g.MetaInfo.ID == actualMetaInfo.ID); Assert.IsNotNull(expectedGame); Assert.AreEqual(expectedGame.MetaInfo, actualMetaInfo); } }