public static Tournament TournamentLoad(string fileName) { if (fileName.StartsWith("http://")) { var url = new Uri(fileName); var req = WebRequest.Create(url); var resp = req.GetResponse(); var stream = resp.GetResponseStream(); return(TournamentLoader.LoadAsync(stream).Result); } else { return(TournamentLoader.LoadAsync(File.OpenRead(fileName)).Result); } }
public async Task TournamentController_Run() { Log.Level = 4; var t = await TournamentLoader.LoadAsync(File.OpenRead("WC2005final01.pbn")); var c = new TournamentController(t, new ParticipantInfo() { PlayerNames = new Participant("North", "East", "South", "West"), ConventionCardNS = "RoboBridge", ConventionCardWE = "RoboBridge", UserId = Guid.NewGuid() }, BridgeEventBus.MainEventBus); var r = new SeatCollection <BridgeRobot>(new BridgeRobot[] { new TestRobot(Seats.North, BridgeEventBus.MainEventBus), new TestRobot(Seats.East, BridgeEventBus.MainEventBus), new TestRobot(Seats.South, BridgeEventBus.MainEventBus), new TestRobot(Seats.West, BridgeEventBus.MainEventBus) }); await c.StartTournamentAsync(); Assert.AreEqual <int>(3, t.Boards[0].Results.Count); Assert.AreEqual <int>(5, t.Boards[0].Results[0].Contract.Bid.Hoogte); Assert.IsTrue(t.Boards[0].Results[0].Play.PlayEnded); Assert.IsFalse(t.Boards[0].Results[2].Auction.Bids[0].IsPass); // opening Assert.IsFalse(t.Boards[0].Results[2].Auction.Bids[1].IsPass); // overcall }