Beispiel #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));
        }
Beispiel #2
0
 private void ToolStripMenuItem11Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         Pinvoke.Setup(openFileDialog1.FileName);
     }
 }
Beispiel #3
0
 public static void setupTest(string testName, Logger logger)
 {
     if (testName is null)
     {
         throw new ArgumentNullException(nameof(testName));
     }
     logger.Info($"Executing test-case {testName}");
     Pinvoke.Setup("Tosr.db3");
 }
        public static void ExecuteTest()
        {
            var fasesWithOffset   = JsonConvert.DeserializeObject <Dictionary <Fase, bool> >(File.ReadAllText("FasesWithOffset.json"));
            var bidGenerator      = new BidGenerator();
            var expectedSouthBids = JsonConvert.DeserializeObject <Dictionary <string, string> >(File.ReadAllText("expectedSouthBidsPerHand.json"));

            Pinvoke.Setup("Tosr.db3");
            foreach (var(hand, expectedBids) in expectedSouthBids)
            {
                var generatedAuction   = BidManager.GetAuction(hand, bidGenerator, fasesWithOffset);
                var generatedSouthBids = generatedAuction.GetBidsAsString(Player.South);
                Assert.Equal(expectedBids, generatedSouthBids);
            }
        }
Beispiel #5
0
        public Form1()
        {
            InitializeComponent();
            ShowBiddingBox();
            ShowAuction();

            // Need to set in code because of a .net core bug
            numericUpDown1.Maximum = 100_000;
            numericUpDown1.Value   = 1000;
            Shuffle();
            BidTillSouth(auctionControl.auction, biddingState);
            Pinvoke.Setup("Tosr.db3");
            openFileDialog1.InitialDirectory = Environment.CurrentDirectory;

            auctionsShape    = LoadAuctions <string>("AuctionsByShape.txt", () => new BatchBidding().GenerateAuctionsForShape());
            auctionsControls = LoadAuctions <List <string> >("AuctionsByControls.txt", () => new BatchBidding().GenerateAuctionsForControls());
        }