public void GameReviewListXmlCloneTest() { var gameReviewList1 = new GameReviewList(); gameReviewList1.Add(new GameReview( 1, 2, 3)); gameReviewList1.Add(new GameReview( 2, 3, 4)); gameReviewList1.Add(new GameReview( 3, 4, 5)); var gameReviewList2 = CloneUtility.XmlClone(gameReviewList1, null); Assert.AreNotSame(gameReviewList1, gameReviewList2); Assert.AreEqual(gameReviewList1.List.Count, gameReviewList2.List.Count); for (var index = 0; index < gameReviewList1.List.Count; index++) { Assert.AreEqual(gameReviewList1.List[index].Id, gameReviewList2.List[index].Id); Assert.AreEqual(gameReviewList1.List[index].GameId, gameReviewList2.List[index].GameId); Assert.AreEqual(gameReviewList1.List[index].ReviewId, gameReviewList2.List[index].ReviewId); } }
public void GameReviewListDictionaryTest() { var gameReviewList1 = new GameReviewList(); gameReviewList1.Add(new GameReview( 1, 2, 3)); gameReviewList1.Add(new GameReview( 2, 3, 4)); gameReviewList1.Add(new GameReview( 3, 4, 5)); var dictionaryList = GameReviewList.ToDictionaryList(gameReviewList1); Assert.IsNotNull(dictionaryList); var gameReviewList2 = GameReviewList.FromDictionaryList(dictionaryList); Assert.AreNotSame(gameReviewList1, gameReviewList2); Assert.AreEqual(gameReviewList1.List.Count, gameReviewList2.List.Count); for (var index = 0; index < gameReviewList1.List.Count; index++) { Assert.AreEqual(gameReviewList1.List[index].Id, gameReviewList2.List[index].Id); Assert.AreEqual(gameReviewList1.List[index].GameId, gameReviewList2.List[index].GameId); Assert.AreEqual(gameReviewList1.List[index].ReviewId, gameReviewList2.List[index].ReviewId); } }
public void GameReviewListJsonTest() { var gameReviewList1 = new GameReviewList(); gameReviewList1.Add(new GameReview( 1, 2, 3)); gameReviewList1.Add(new GameReview( 2, 3, 4)); gameReviewList1.Add(new GameReview( 3, 4, 5)); var jsonText = CloneUtility.ToJson(gameReviewList1); Assert.IsFalse(string.IsNullOrEmpty(jsonText)); var gameReviewList2 = CloneUtility.FromJson <GameReviewList>(jsonText); Assert.AreNotSame(gameReviewList1, gameReviewList2); Assert.AreEqual(gameReviewList1.List.Count, gameReviewList2.List.Count); for (var index = 0; index < gameReviewList1.List.Count; index++) { Assert.AreEqual(gameReviewList1.List[index].Id, gameReviewList2.List[index].Id); Assert.AreEqual(gameReviewList1.List[index].GameId, gameReviewList2.List[index].GameId); Assert.AreEqual(gameReviewList1.List[index].ReviewId, gameReviewList2.List[index].ReviewId); } }
public void GameReviewListExistsTest() { var gameReviewList = new GameReviewList(); gameReviewList.Add(new GameReview( 1, 2, 3)); gameReviewList.Add(new GameReview( 2, 3, 4)); gameReviewList.Add(new GameReview( 3, 4, 5)); Assert.IsFalse(gameReviewList.Exists(0)); Assert.IsFalse(gameReviewList.Exists(-1)); Assert.AreEqual(gameReviewList.Exists(1), true); Assert.AreEqual(gameReviewList.Exists(2), true); Assert.AreEqual(gameReviewList.Exists(3), true); }
public void GameReviewListGetByIdTest() { var gameReviewList = new GameReviewList(); gameReviewList.Add(new GameReview( 1, 2, 3)); gameReviewList.Add(new GameReview( 2, 3, 4)); gameReviewList.Add(new GameReview( 3, 4, 5)); var gameReview = gameReviewList.GetById(0); Assert.AreEqual(gameReview, null); gameReview = gameReviewList.GetById(-1); Assert.AreEqual(gameReview, null); gameReview = gameReviewList.GetById(1); Assert.AreEqual(gameReview.GameId, 2); gameReview = gameReviewList.GetById(2); Assert.AreEqual(gameReview.GameId, 3); gameReview = gameReviewList.GetById(3); Assert.AreEqual(gameReview.GameId, 4); }
public void GameReviewListTestConstructorTest() { var gameReviewList = new GameReviewList(); Assert.IsNotNull(gameReviewList); Assert.AreEqual(gameReviewList.List.Count, 0); }
public void GameReviewListAddandRemoveTest() { var gameReviewList = new GameReviewList(); Assert.AreEqual(gameReviewList.List.Count, 0); gameReviewList.Add(new GameReview( 1, 2, 3)); Assert.AreEqual(gameReviewList.List.Count, 1); gameReviewList.Add(new GameReview( 2, 3, 4)); Assert.AreEqual(gameReviewList.List.Count, 2); gameReviewList.Add(new GameReview( 3, 4, 5)); Assert.AreEqual(gameReviewList.List.Count, 3); gameReviewList.Remove(1); Assert.AreEqual(gameReviewList.List.Count, 2); gameReviewList.Remove(3); Assert.AreEqual(gameReviewList.List.Count, 1); gameReviewList.Remove(2); Assert.AreEqual(gameReviewList.List.Count, 0); }