Exemplo n.º 1
0
        public void GameListDictionaryTest()
        {
            var gameList1 = new GameList();

            gameList1.Add(new Game(
                              1,
                              "Name1",
                              "Description1"));

            gameList1.Add(new Game(
                              2,
                              "Name2",
                              "Description2"));

            gameList1.Add(new Game(
                              3,
                              "Name3",
                              "Description3"));

            var dictionaryList = GameList.ToDictionaryList(gameList1);

            Assert.IsNotNull(dictionaryList);

            var gameList2 = GameList.FromDictionaryList(dictionaryList);

            Assert.AreNotSame(gameList1, gameList2);
            Assert.AreEqual(gameList1.List.Count, gameList2.List.Count);

            for (var index = 0; index < gameList1.List.Count; index++)
            {
                Assert.AreEqual(gameList1.List[index].Id, gameList2.List[index].Id);
                Assert.AreEqual(gameList1.List[index].Name, gameList2.List[index].Name);
                Assert.AreEqual(gameList1.List[index].Description, gameList2.List[index].Description);
            }
        }