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)); }
private void ToolStripMenuItem11Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { Pinvoke.Setup(openFileDialog1.FileName); } }
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); } }
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()); }