Example #1
0
        public void TestAuctionsQueens(string testName, string northHand, string southHand, string expectedBidsNorth, string expectedBidsSouth)
        {
            // This test can fail because it relies on the sampling and dds.
            if (testName is null)
            {
                throw new ArgumentNullException(nameof(testName));
            }
            logger.Info($"Executing testcase {testName}");

            _ = Pinvoke.Setup("Tosr.db3");
            var bidManager      = new BidManager(new BidGenerator(), fasesWithOffset, reverseDictionaries, true, false);
            var auction         = bidManager.GetAuction(northHand, southHand);
            var actualBidsSouth = auction.GetBidsAsString(Player.South);

            Assert.Equal(expectedBidsSouth, actualBidsSouth);

            var actualBidsNorth = auction.GetBidsAsString(Player.North);

            Assert.Equal(expectedBidsNorth, actualBidsNorth);

            var constructedSouthHand = bidManager.biddingInformation.ConstructSouthHand(northHand);

            Assert.Equal(Util.HandWithx(southHand), constructedSouthHand.First());

            var queens = bidManager.biddingInformation.GetQueensFromAuction(auction, reverseDictionaries);

            Assert.True(BiddingInformation.CheckQueens(queens, southHand));
        }
Example #2
0
        public static void AssertHand(BiddingInformation bidManager, Auction auction, string northHand, string southHand, ReverseDictionaries reverseDictionaries)
        {
            var constructedSouthHand = bidManager.ConstructSouthHand(northHand);

            Assert.Equal(Util.HandWithx(southHand), constructedSouthHand.First());

            var queens = bidManager.GetQueensFromAuction(auction, reverseDictionaries);

            Assert.True(BiddingInformation.CheckQueens(queens, southHand));
        }
Example #3
0
        private static void TestFaseWithOffset(string testName, int zoomOffset, string[] bids, Fase[] fases, Fase[] pullFases, string expected)
        {
            if (testName is null)
            {
                throw new ArgumentNullException(nameof(testName));
            }
            var auction = new Auction();

            Assert.Equal(bids.Length, fases.Length);
            var enumerable = fases.Zip(pullFases, (x, y) => (x, y)).Zip(bids, (x, z) => (z, x.x, x.y));

            SetBids(auction, enumerable);
            var actual = string.Join("", BiddingInformation.GetAuctionForFaseWithOffset(auction, zoomOffset, Fase.Controls, Fase.ScanningControls));

            Assert.Equal(expected, actual);
        }
Example #4
0
 public void MergeControlAndShapeTest(string expected, string[] controls, string shapeLengthStr)
 {
     Assert.Equal(expected, string.Join(',', BiddingInformation.MergeControlAndShape(controls, shapeLengthStr)));
 }