Ejemplo n.º 1
0
        private static IEnumerable <IGameWithMetaInfo> GetStubGames()
        {
            GameMetaInfo metaInfo;
            IGame        game;

            metaInfo = new GameMetaInfo(0, GameSize.SMALL, GameDifficulty.EASY);
            game     = new GameFactory().GenerateEmptyGame(1, 1);
            game.Grid[new Utility.GridPoint(0, 0)] = BimaruValue.SHIP_CONT_DOWN;
            yield return(new GameWithMetaInfo(metaInfo, game));

            metaInfo = new GameMetaInfo(1, GameSize.SMALL, GameDifficulty.MIDDLE);
            game     = new GameFactory().GenerateEmptyGame(1, 1);
            game.Grid[new Utility.GridPoint(0, 0)] = BimaruValue.SHIP_CONT_LEFT;
            yield return(new GameWithMetaInfo(metaInfo, game));

            metaInfo = new GameMetaInfo(2, GameSize.MIDDLE, GameDifficulty.EASY);
            game     = new GameFactory().GenerateEmptyGame(1, 1);
            game.Grid[new Utility.GridPoint(0, 0)] = BimaruValue.SHIP_CONT_LEFT;
            yield return(new GameWithMetaInfo(metaInfo, game));

            metaInfo = new GameMetaInfo(3, GameSize.MIDDLE, GameDifficulty.HARD);
            game     = new GameFactory().GenerateEmptyGame(1, 1);
            game.Grid[new Utility.GridPoint(0, 0)] = BimaruValue.SHIP_CONT_LEFT;
            yield return(new GameWithMetaInfo(metaInfo, game));
        }
Ejemplo n.º 2
0
        public void TestEqualityDifferentDifficulty()
        {
            var game0 = new GameMetaInfo(0, GameSize.LARGE, GameDifficulty.EASY);
            var game1 = new GameMetaInfo(0, GameSize.LARGE, GameDifficulty.HARD);

            Assert.AreNotEqual(game0, game1);
        }
Ejemplo n.º 3
0
        public void TestEqualitySameData()
        {
            var game0 = new GameMetaInfo(0, GameSize.LARGE, GameDifficulty.EASY);
            var game1 = new GameMetaInfo(0, GameSize.LARGE, GameDifficulty.EASY);

            Assert.AreEqual(game0, game1);
        }
Ejemplo n.º 4
0
        public void TestNullArguments()
        {
            var metaInfo = new GameMetaInfo(0, GameSize.LARGE, GameDifficulty.EASY);
            var game     = new GameFactory().GenerateEmptyGame(1, 1);

            Assert.ThrowsException <ArgumentNullException>(
                () => new GameWithMetaInfo(null, game));

            Assert.ThrowsException <ArgumentNullException>(
                () => new GameWithMetaInfo(metaInfo, null));

            new GameWithMetaInfo(metaInfo, game);
        }
Ejemplo n.º 5
0
        public static bool Equals(GameMetaInfo objLeft, IGameMetaInfo objRight)
        {
            if (objLeft == null && objRight == null)
            {
                return(true);
            }

            if (objLeft == null)
            {
                return(objRight.Equals(objLeft));
            }
            else
            {
                return(objLeft.Equals(objRight));
            }
        }
Ejemplo n.º 6
0
        public void TestEqualitySameObject()
        {
            var game = new GameMetaInfo(0, GameSize.LARGE, GameDifficulty.EASY);

            Assert.AreEqual(game, game);
        }