Ejemplo n.º 1
0
        public void MakeGoodOne()
        {
            var board      = new Board();
            var hands      = board.Hands;
            var myHand     = hands[Seat.South];
            var otherHands = hands.OtherHands(Seat.South);

            new Deck()
            .Shuffle()
            .Deal(hands);
            var fact = new Hcp(23);

            Assert.IsTrue(fact.MakeGood(myHand, otherHands));
            Console.WriteLine(board);
            Assert.AreEqual(23, HcpEvaluator.GetHcp(myHand));

            new Deck()
            .Shuffle()
            .Deal(hands);
            fact = new Hcp(12, 14);
            Assert.IsTrue(fact.MakeGood(myHand, otherHands));
            Console.WriteLine(board);
            int hcp = HcpEvaluator.GetHcp(myHand);

            Assert.IsTrue(12 <= hcp && hcp <= 14);

            new Deck()
            .Shuffle()
            .Deal(hands);
            fact = new Hcp(42);
            Assert.IsFalse(fact.MakeGood(myHand, otherHands));
        }
Ejemplo n.º 2
0
        public void Stringing()
        {
            var fact = new Hcp(2);

            Assert.AreEqual("Hcp(2)", fact.ToString());

            fact = new Hcp(2, 4);
            Assert.AreEqual("Hcp(2, 4)", fact.ToString());
        }
Ejemplo n.º 3
0
        public void Constructors()
        {
            var fact = new Hcp(2);

            Assert.AreEqual(2, fact.Minimum);
            Assert.AreEqual(2, fact.Maximum);

            fact = new Hcp(2, 4);
            Assert.AreEqual(2, fact.Minimum);
            Assert.AreEqual(4, fact.Maximum);
        }