Esempio n. 1
0
        public void RatingListJsonTest()
        {
            var ratingList1 = new RatingList();

            ratingList1.Add(new Rating(1, "Name1", "Description1", "Symbol1"));
            ratingList1.Add(new Rating(2, "Name2", "Description2", "Symbol2"));
            ratingList1.Add(new Rating(3, "Name3", "Description3", "Symbol3"));

            var jsontext = CloneUtility.ToJson(ratingList1);

            Assert.IsFalse(string.IsNullOrEmpty(jsontext));

            var ratingList2 = CloneUtility.FromJson <RatingList>(jsontext);

            Assert.AreNotSame(ratingList1, ratingList2);
            Assert.AreEqual(ratingList1.List.Count, ratingList2.List.Count);

            for (var index = 0; index < ratingList1.List.Count; index++)
            {
                Assert.AreEqual(ratingList1.List[index].Id, ratingList2.List[index].Id);
                Assert.AreEqual(ratingList1.List[index].Name, ratingList2.List[index].Name);
                Assert.AreEqual(ratingList1.List[index].Description, ratingList2.List[index].Description);
                Assert.AreEqual(ratingList1.List[index].Symbol, ratingList2.List[index].Symbol);
            }
        }
Esempio n. 2
0
        public void GameListJsonTest()
        {
            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 jsonText = CloneUtility.ToJson(gameList1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gameList2 = CloneUtility.FromJson <GameList>(jsonText);

            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);
            }
        }
Esempio n. 3
0
        public void GameRatingListJsonTest()
        {
            var gameRatingList1 = new GameRatingList();

            gameRatingList1.Add(new GameRating(
                                    1,
                                    2,
                                    3, "Notes1"));

            gameRatingList1.Add(new GameRating(
                                    2,
                                    3,
                                    4, "Notes2"));

            gameRatingList1.Add(new GameRating(
                                    3,
                                    4,
                                    5, "Notes3"));

            var jsonText = CloneUtility.ToJson(gameRatingList1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gameRatingList2 = CloneUtility.FromJson <GameRatingList>(jsonText);

            Assert.AreNotSame(gameRatingList1, gameRatingList2);
            Assert.AreEqual(gameRatingList1.List.Count, gameRatingList2.List.Count);

            for (var index = 0; index < gameRatingList1.List.Count; index++)
            {
                Assert.AreEqual(gameRatingList1.List[index].Id, gameRatingList2.List[index].Id);
                Assert.AreEqual(gameRatingList1.List[index].GameId, gameRatingList2.List[index].GameId);
                Assert.AreEqual(gameRatingList1.List[index].RatingId, gameRatingList2.List[index].RatingId);
            }
        }
Esempio n. 4
0
        public void GameImageJsonTest()
        {
            var gameImage1 = new GameImage(
                1,
                2,
                _imageData);

            var jsonText = CloneUtility.ToJson(gameImage1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gameImage2 = CloneUtility.FromJson <GameImage>(jsonText);

            Assert.AreNotSame(gameImage1, gameImage2);

            Assert.AreEqual(gameImage1.Id, gameImage2.Id);
            Assert.AreEqual(gameImage1.GameId, gameImage2.GameId);

            if (gameImage1.Image != null)
            {
                Assert.IsTrue(gameImage1.Image.SequenceEqual(gameImage2.Image));
            }

            else
            {
                Assert.IsNull(gameImage1.Image);
                Assert.IsNull(gameImage2.Image);
            }
        }
Esempio n. 5
0
        public void GamePlatformListJsonTest()
        {
            var gamePlatformList1 = new GamePlatformList();

            gamePlatformList1.Add(new GamePlatform(
                                      1,
                                      2,
                                      3));

            gamePlatformList1.Add(new GamePlatform(
                                      2,
                                      3,
                                      4));

            gamePlatformList1.Add(new GamePlatform(
                                      3,
                                      4,
                                      5));

            var jsonText = CloneUtility.ToJson(gamePlatformList1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gamePlatformList2 = CloneUtility.FromJson <GamePlatformList>(jsonText);

            Assert.AreNotSame(gamePlatformList1, gamePlatformList2);
            Assert.AreEqual(gamePlatformList1.List.Count, gamePlatformList2.List.Count);

            for (var index = 0; index < gamePlatformList1.List.Count; index++)
            {
                Assert.AreEqual(gamePlatformList1.List[index].Id, gamePlatformList2.List[index].Id);
                Assert.AreEqual(gamePlatformList1.List[index].GameId, gamePlatformList2.List[index].GameId);
                Assert.AreEqual(gamePlatformList1.List[index].PlatformId, gamePlatformList2.List[index].PlatformId);
            }
        }
Esempio n. 6
0
        public void PlatformJsonTest()
        {
            var platform1 = new Platform(1, "Name", "Maker");

            var jsontext = CloneUtility.ToJson(platform1);

            Assert.IsFalse(string.IsNullOrEmpty(jsontext));

            var platform2 = CloneUtility.FromJson <Platform>(jsontext);

            Assert.AreNotSame(platform1, platform2);

            Assert.AreEqual(platform1.Id, platform2.Id);
            Assert.AreEqual(platform1.Name, platform2.Name);
            Assert.AreEqual(platform1.Maker, platform2.Maker);
        }
Esempio n. 7
0
        public void GenreJsonTest()
        {
            var genre1 = new Genre(1, "Name", "Description");

            var jsontext = CloneUtility.ToJson(genre1);

            Assert.IsFalse(string.IsNullOrEmpty(jsontext));

            var genre2 = CloneUtility.FromJson <Genre>(jsontext);

            Assert.AreNotSame(genre1, genre2);

            Assert.AreEqual(genre1.Id, genre2.Id);
            Assert.AreEqual(genre1.Name, genre2.Name);
            Assert.AreEqual(genre1.Description, genre2.Description);
        }
Esempio n. 8
0
        public void RatingJsonTest()
        {
            var rating1 = new Rating(1, "Name", "Description", "Symbol");

            var jsontext = CloneUtility.ToJson(rating1);

            Assert.IsFalse(string.IsNullOrEmpty(jsontext));

            var rating2 = CloneUtility.FromJson <Rating>(jsontext);

            Assert.AreNotSame(rating1, rating2);

            Assert.AreEqual(rating1.Id, rating2.Id);
            Assert.AreEqual(rating1.Name, rating2.Name);
            Assert.AreEqual(rating1.Description, rating2.Description);
            Assert.AreEqual(rating1.Symbol, rating2.Symbol);
        }
Esempio n. 9
0
        public void ReviewJsonTest()
        {
            var rating1 = new Review(1, "Name", "Description", 2);

            var jsontext = CloneUtility.ToJson(rating1);

            Assert.IsFalse(string.IsNullOrEmpty(jsontext));

            var rating2 = CloneUtility.FromJson <Review>(jsontext);

            Assert.AreNotSame(rating1, rating2);

            Assert.AreEqual(rating1.Id, rating2.Id);
            Assert.AreEqual(rating1.Name, rating2.Name);
            Assert.AreEqual(rating1.Description, rating2.Description);
            Assert.AreEqual(rating1.Reviewrating, rating2.Reviewrating);
        }
Esempio n. 10
0
        public void GameRatingJsonTest()
        {
            var gameRating1 = new GameRating(
                1,
                2,
                3, "Notes");

            var jsonText = CloneUtility.ToJson(gameRating1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gameRating2 = CloneUtility.FromJson <GameRating>(jsonText);

            Assert.AreNotSame(gameRating1, gameRating2);

            Assert.AreEqual(gameRating1.Id, gameRating2.Id);
            Assert.AreEqual(gameRating1.GameId, gameRating2.GameId);
            Assert.AreEqual(gameRating1.RatingId, gameRating2.RatingId);
        }
Esempio n. 11
0
        public void GameGenreJsonTest()
        {
            var gameGenre1 = new GameGenre(
                1,
                2,
                3);

            var jsonText = CloneUtility.ToJson(gameGenre1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gameGenre2 = CloneUtility.FromJson <GameGenre>(jsonText);

            Assert.AreNotSame(gameGenre1, gameGenre2);

            Assert.AreEqual(gameGenre1.Id, gameGenre2.Id);
            Assert.AreEqual(gameGenre1.GameId, gameGenre2.GameId);
            Assert.AreEqual(gameGenre1.GenreId, gameGenre2.GenreId);
        }
Esempio n. 12
0
        public void GamePlatformJsonTest()
        {
            var gamePlatform1 = new GamePlatform(
                1,
                2,
                3);

            var jsonText = CloneUtility.ToJson(gamePlatform1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gamePlatform2 = CloneUtility.FromJson <GamePlatform>(jsonText);

            Assert.AreNotSame(gamePlatform1, gamePlatform2);

            Assert.AreEqual(gamePlatform1.Id, gamePlatform2.Id);
            Assert.AreEqual(gamePlatform1.GameId, gamePlatform2.GameId);
            Assert.AreEqual(gamePlatform1.PlatformId, gamePlatform2.PlatformId);
        }
Esempio n. 13
0
        public void GameReviewJsonTest()
        {
            var gameReview1 = new GameReview(
                1,
                2,
                3);

            var jsonText = CloneUtility.ToJson(gameReview1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gameReview2 = CloneUtility.FromJson <GameReview>(jsonText);

            Assert.AreNotSame(gameReview1, gameReview2);

            Assert.AreEqual(gameReview1.Id, gameReview2.Id);
            Assert.AreEqual(gameReview1.GameId, gameReview2.GameId);
            Assert.AreEqual(gameReview1.ReviewId, gameReview2.ReviewId);
        }
Esempio n. 14
0
        public void PlatformListJsonTest()
        {
            var platformList1 = new PlatformList();

            platformList1.Add(new Platform(1, "Name1", "Maker1"));
            platformList1.Add(new Platform(2, "Name2", "Maker2"));
            platformList1.Add(new Platform(3, "Name3", "Maker3"));

            var jsontext = CloneUtility.ToJson(platformList1);

            Assert.IsFalse(string.IsNullOrEmpty(jsontext));

            var platformList2 = CloneUtility.FromJson <PlatformList>(jsontext);

            Assert.AreNotSame(platformList1, platformList2);
            Assert.AreEqual(platformList1.List.Count, platformList2.List.Count);

            for (var index = 0; index < platformList1.List.Count; index++)
            {
                Assert.AreEqual(platformList1.List[index].Id, platformList2.List[index].Id);
                Assert.AreEqual(platformList1.List[index].Name, platformList2.List[index].Name);
                Assert.AreEqual(platformList1.List[index].Maker, platformList2.List[index].Maker);
            }
        }
Esempio n. 15
0
        public void GameImageListJsonTest()
        {
            var gameImageList1 = new GameImageList();

            gameImageList1.Add(new GameImage(1, 2, _imageData));

            gameImageList1.Add(new GameImage(3, 4, null));

            gameImageList1.Add(new GameImage(5, 6, _imageData));

            var jsonText = CloneUtility.ToJson(gameImageList1);

            Assert.IsFalse(string.IsNullOrEmpty(jsonText));

            var gameImageList2 = CloneUtility.FromJson <GameImageList>(jsonText);

            Assert.AreNotSame(gameImageList1, gameImageList2);
            Assert.AreEqual(gameImageList1.List.Count, gameImageList2.List.Count);

            for (var index = 0; index < gameImageList1.List.Count; index++)
            {
                Assert.AreEqual(gameImageList1.List[index].Id, gameImageList2.List[index].Id);
                Assert.AreEqual(gameImageList1.List[index].GameId, gameImageList2.List[index].GameId);

                if (gameImageList1.List[index].Image != null)
                {
                    Assert.IsTrue(gameImageList1.List[index].Image.SequenceEqual(gameImageList2.List[index].Image));
                }

                else
                {
                    Assert.IsNull(gameImageList1.List[index].Image);
                    Assert.IsNull(gameImageList2.List[index].Image);
                }
            }
        }