Exemple #1
0
        public void ExecuteShuffleTest()
        {
            var shufflingDeal = new ShufflingDeal
            {
                North = new North {
                    Hcp = new MinMax(16, 37)
                },
                South = new South {
                    Hcp = new MinMax(7, 37), Controls = new MinMax(2, 12)
                }
            };

            var boards = shufflingDeal.Execute();

            Assert.Equal(10, boards.Length);
            Assert.All(boards, (board) =>
            {
                var hands = Util.GetBoardsTosr(board);
                Assert.All(hands, (hand) => Assert.Equal(16, hand.Length));
                // Check north
                var handNorth = hands[(int)Player.North];
                Assert.InRange(Util.GetHcpCount(handNorth), 16, 37);
                // Check south
                var handSouth = hands[(int)Player.South];
                Assert.InRange(Util.GetHcpCount(handSouth), 7, 37);
                Assert.InRange(Util.GetControlCount(handSouth), 2, 12);
            });
        }
Exemple #2
0
        public void ShapeSpecificControlWithQueensWithHcpTest()
        {
            const string expectedNorthHand = "J432.AQJ2.AQ2.K2";
            const string queens            = "YNNX";
            const string shape             = "5413";
            const int    controls          = 4;
            var          specificControls  = new string[] { "AK", "", "K", "" };
            const int    minHcp            = 14;
            const int    maxHcp            = 15;

            var shufflingDeal = new ShufflingDeal()
            {
                North = new North {
                    Hand = expectedNorthHand.Split(".")
                },
                South = new South {
                    Hcp = new MinMax(minHcp, maxHcp), Controls = new MinMax(controls, controls), Shape = shape, SpecificControls = specificControls, Queens = queens,
                }
            };

            var boards = shufflingDeal.Execute();

            Assert.Equal(10, boards.Length);
            Assert.All(boards, (board) => CheckBoard(board, shufflingDeal));
        }
Exemple #3
0
        public void ShapeControlTest()
        {
            var          expectedNorthHand = "K432.AQJ2.A32.K2";
            const string shape             = "5413";
            const int    controls          = 3;

            var shufflingDeal = new ShufflingDeal
            {
                North = new North {
                    Hand = expectedNorthHand.Split(".")
                },
                South = new South {
                    Hcp = new MinMax(7, 37), Controls = new MinMax(controls, controls), Shape = shape
                }
            };

            var boards = shufflingDeal.Execute();

            Assert.Equal(10, boards.Length);
            Assert.All(boards, (board) => CheckBoard(board, shufflingDeal));
        }
Exemple #4
0
        public void ShapeSpecificControlTest()
        {
            const string expectedNorthHand = "QJ32.AQJ2.A32.K2";
            var          specificControls  = new string[] { "AK", "", "K", "" };
            const string shape             = "5413";
            const int    controls          = 4;

            var shufflingDeal = new ShufflingDeal()
            {
                North = new North {
                    Hand = expectedNorthHand.Split(".")
                },
                South = new South {
                    Controls = new MinMax(controls, controls), Shape = shape, SpecificControls = specificControls
                }
            };

            var boards = shufflingDeal.Execute();

            Assert.Equal(10, boards.Length);
            Assert.All(boards, (board) => CheckBoard(board, shufflingDeal));
        }