Example #1
0
        public void when_TeamBets_then_GameStateChanges()
        {
            var gs = CreateFullGamestate();

            gs = mainService.StartGame();
            gs = mainService.StartFirstRound(gs);
            gs = mainService.StartLicitation(gs);
            Assert.AreEqual(States.Licitation, gs.State);
            gs = mainService.Bet(gs, 0, 500);
            gs = mainService.Bet(gs, 1, 400);
            Assert.AreEqual(1100, gs.Licitation.Pool);

            //TODO: Fin!
        }
        private void BidKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                var    tb  = sender as TextBox;
                string txt = tb.Tag as string;
                int    teamNumber;
                if (tb != null && int.TryParse(txt, out teamNumber))
                {
                    int bid;

                    if (tb.Text == "V" || tb.Text == "v")
                    {
                        GS = mainService.GoVabank(GS, teamNumber);
                    }
                    else if (int.TryParse(tb.Text as string, out bid))
                    {
                        bid *= 100;
                        if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                        {
                            GS = mainService.BetWithoutRestrictions(GS, teamNumber, bid);
                        }
                        else
                        {
                            GS = mainService.Bet(GS, teamNumber, bid);
                        }
                        ImportGameState(GS);
                        webService.UpdateGameState(GS);
                    }
                }
            }
        }