示例#1
0
        public void GameGenreListDictionaryTest()
        {
            var gameGenreList1 = new GameGenreList();

            gameGenreList1.Add(new GameGenre(
                                   1,
                                   2,
                                   3));

            gameGenreList1.Add(new GameGenre(
                                   2,
                                   3,
                                   4));

            gameGenreList1.Add(new GameGenre(
                                   3,
                                   4,
                                   5));

            var dictionaryList = GameGenreList.ToDictionaryList(gameGenreList1);

            Assert.IsNotNull(dictionaryList);

            var gameGenreList2 = GameGenreList.FromDictionaryList(dictionaryList);

            Assert.AreNotSame(gameGenreList1, gameGenreList2);
            Assert.AreEqual(gameGenreList1.List.Count, gameGenreList2.List.Count);

            for (var index = 0; index < gameGenreList1.List.Count; index++)
            {
                Assert.AreEqual(gameGenreList1.List[index].Id, gameGenreList2.List[index].Id);
                Assert.AreEqual(gameGenreList1.List[index].GameId, gameGenreList2.List[index].GameId);
                Assert.AreEqual(gameGenreList1.List[index].GenreId, gameGenreList2.List[index].GenreId);
            }
        }
示例#2
0
        public void GameGenreListJsonTest()
        {
            var gameGenreList1 = new GameGenreList();

            gameGenreList1.Add(new GameGenre(
                                   1,
                                   2,
                                   3));

            gameGenreList1.Add(new GameGenre(
                                   2,
                                   3,
                                   4));

            gameGenreList1.Add(new GameGenre(
                                   3,
                                   4,
                                   5));

            var jsonText = CloneUtility.ToJson(gameGenreList1);

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

            var gameGenreList2 = CloneUtility.FromJson <GameGenreList>(jsonText);

            Assert.AreNotSame(gameGenreList1, gameGenreList2);
            Assert.AreEqual(gameGenreList1.List.Count, gameGenreList2.List.Count);

            for (var index = 0; index < gameGenreList1.List.Count; index++)
            {
                Assert.AreEqual(gameGenreList1.List[index].Id, gameGenreList2.List[index].Id);
                Assert.AreEqual(gameGenreList1.List[index].GameId, gameGenreList2.List[index].GameId);
                Assert.AreEqual(gameGenreList1.List[index].GenreId, gameGenreList2.List[index].GenreId);
            }
        }
示例#3
0
        public void GameGenreListXmlCloneTest()
        {
            var gameGenreList1 = new GameGenreList();

            gameGenreList1.Add(new GameGenre(
                                   1,
                                   2,
                                   3));

            gameGenreList1.Add(new GameGenre(
                                   2,
                                   3,
                                   4));

            gameGenreList1.Add(new GameGenre(
                                   3,
                                   4,
                                   5));

            var gameGenreList2 = CloneUtility.XmlClone(gameGenreList1, null);

            Assert.AreNotSame(gameGenreList1, gameGenreList2);
            Assert.AreEqual(gameGenreList1.List.Count, gameGenreList2.List.Count);

            for (var index = 0; index < gameGenreList1.List.Count; index++)
            {
                Assert.AreEqual(gameGenreList1.List[index].Id, gameGenreList2.List[index].Id);
                Assert.AreEqual(gameGenreList1.List[index].GameId, gameGenreList2.List[index].GameId);
                Assert.AreEqual(gameGenreList1.List[index].GenreId, gameGenreList2.List[index].GenreId);
            }
        }
示例#4
0
        public void GameGenreListExistsTest()
        {
            var gameGenreList = new GameGenreList();

            gameGenreList.Add(new GameGenre(
                                  1,
                                  2,
                                  3));

            gameGenreList.Add(new GameGenre(
                                  2,
                                  3,
                                  4));

            gameGenreList.Add(new GameGenre(
                                  3,
                                  4,
                                  5));

            Assert.IsFalse(gameGenreList.Exists(0));
            Assert.IsFalse(gameGenreList.Exists(-1));
            Assert.AreEqual(gameGenreList.Exists(1), true);
            Assert.AreEqual(gameGenreList.Exists(2), true);
            Assert.AreEqual(gameGenreList.Exists(3), true);
        }
示例#5
0
        public void GameGenreListGetByIdTest()
        {
            var gameGenreList = new GameGenreList();

            gameGenreList.Add(new GameGenre(
                                  1,
                                  2,
                                  3));

            gameGenreList.Add(new GameGenre(
                                  2,
                                  3,
                                  4));

            gameGenreList.Add(new GameGenre(
                                  3,
                                  4,
                                  5));

            var gameGenre = gameGenreList.GetById(0);

            Assert.AreEqual(gameGenre, null);

            gameGenre = gameGenreList.GetById(-1);
            Assert.AreEqual(gameGenre, null);

            gameGenre = gameGenreList.GetById(1);
            Assert.AreEqual(gameGenre.GameId, 2);

            gameGenre = gameGenreList.GetById(2);
            Assert.AreEqual(gameGenre.GameId, 3);

            gameGenre = gameGenreList.GetById(3);
            Assert.AreEqual(gameGenre.GameId, 4);
        }
示例#6
0
        public void GameGenreListTestConstructorTest()
        {
            var gameGenreList = new GameGenreList();

            Assert.IsNotNull(gameGenreList);
            Assert.AreEqual(gameGenreList.List.Count, 0);
        }
示例#7
0
        public void GameGenreListAddandRemoveTest()
        {
            var gameGenreList = new GameGenreList();

            Assert.AreEqual(gameGenreList.List.Count, 0);

            gameGenreList.Add(new GameGenre(
                                  1,
                                  2,
                                  3));

            Assert.AreEqual(gameGenreList.List.Count, 1);

            gameGenreList.Add(new GameGenre(
                                  2,
                                  3,
                                  4));

            Assert.AreEqual(gameGenreList.List.Count, 2);

            gameGenreList.Add(new GameGenre(
                                  3,
                                  4,
                                  5));

            Assert.AreEqual(gameGenreList.List.Count, 3);

            gameGenreList.Remove(1);

            Assert.AreEqual(gameGenreList.List.Count, 2);

            gameGenreList.Remove(3);

            Assert.AreEqual(gameGenreList.List.Count, 1);

            gameGenreList.Remove(2);

            Assert.AreEqual(gameGenreList.List.Count, 0);
        }
示例#8
0
 public void GameGenreListGenerateSelectQueryTest()
 {
     Assert.AreEqual(GameGenreList.GenerateSelectQueryByGameId(1), "SELECT Id, GameId, GenreId FROM GameGenre WHERE GameId = 1");
     Assert.AreEqual(GameGenreList.GenerateSelectQueryByGenreId(2), "SELECT Id, GameId, GenreId FROM GameGenre WHERE GenreId = 2");
 }