Exemplo n.º 1
0
        public void CanGetEmptyCollection()
        {
            using (var store = GetDocumentStore())
            {
                new CasinosSuspensionsIndex().Execute(store);

                using (var documentSession = store.OpenSession())
                {
                    var casino = new Casino("cities/1", "address", "name")
                    {
                        Suspensions = new List <Suspension>
                        {
                            new Suspension(DateTime.UtcNow, new List <Exemption>())
                        }
                    };
                    documentSession.Store(casino);
                    documentSession.SaveChanges();

                    var suspensions = documentSession.Query <CasinosSuspensionsIndex.IndexResult, CasinosSuspensionsIndex>().
                                      Customize(x => x.WaitForNonStaleResults()).
                                      Where(x => x.CityId == "cities/1").
                                      OrderByDescending(x => x.DateTime).
                                      Take(10).
                                      ProjectInto <CasinosSuspensionsIndex.IndexResult>().
                                      ToList();

                    // note that suspensions[0].Exemptions will be null, because we don't have
                    // any values in the array, and we don't store empty arrays
                    Assert.NotEmpty(suspensions);
                    Assert.Null(suspensions.Single().Exemptions);
                }
            }
        }
Exemplo n.º 2
0
        public void WinningMultiplierDependsOnWinningProbability()
        {
            var rollCount = 2;

            var multipliers = new Dictionary <int, int>
            {
                { 2, 36 },
                { 3, 18 },
                { 4, 12 },
                { 5, 9 },
                { 6, 7 },
                { 7, 6 },
                { 8, 7 },
                { 9, 9 },
                { 10, 12 },
                { 11, 18 },
                { 12, 36 }
            };

            foreach (var score in multipliers.Keys)
            {
                var multiplier = multipliers[score];
                Assert.AreEqual(multiplier, Casino.GetMultiplier(score, rollCount));
            }
        }
Exemplo n.º 3
0
        public void GivenACasino_WhenGetTableThatDoesNotExist_ThenNullIsReturned()
        {
            var casino = new Casino();
            var table  = casino.GetTable(123);

            table.Should().BeNull();
        }
Exemplo n.º 4
0
		public void CanGetEmptyCollection()
		{
			using (var store = NewDocumentStore())
			{
				new CasinosSuspensionsIndex().Execute(store);

				using (var documentSession = store.OpenSession())
				{

					var casino = new Casino("cities/1", "address", "name")
					{
						Suspensions = new List<Suspension>()
						{
							new Suspension(DateTime.UtcNow, new List<Exemption>())
						}
					};
					documentSession.Store(casino);
					documentSession.SaveChanges();

					var suspensions = documentSession.Query<CasinosSuspensionsIndex.IndexResult, CasinosSuspensionsIndex>().
						Customize(x=>x.WaitForNonStaleResults()).
						Where(x => x.CityId == "cities/1").
						OrderByDescending(x => x.DateTime).
						Take(10).
						AsProjection<CasinosSuspensionsIndex.IndexResult>().
						ToList();

					// note that suspensions[0].Exemptions will be null, because we don't have
					// any values in the array, and we don't store empty arrays
					Assert.NotEmpty(suspensions);
				}
			}
		}
Exemplo n.º 5
0
        /// <summary>
        /// evento que al apretar comprar abre el Form Comprar y update el Datatable y la Base de datos con los nuevos datos
        /// de ese form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnComprar_Click(object sender, EventArgs e)
        {
            this.comprar = new FormComprarMonedas(this.empresa);
            this.comprar.ShowDialog();

            if (this.comprar.DialogResult == DialogResult.OK)
            {
                if (this.empresa == this.comprar.participante)//si ya esta en el casino
                {
                    //update row
                    DataRow fila = this.dt.Rows.Find(this.comprar.participante.DNI);
                    this.empresa += this.comprar.primera;
                    this.LlenarFilaComprar(fila);
                    this.dt.AcceptChanges();
                    if (this.acces.ModificarJuego(this.comprar.primera) == false)
                    {
                        MessageBox.Show("Problemas al conectar con base de datos");
                    }
                }
                else//si no esta
                {
                    this.empresa += this.comprar.participante;
                    this.empresa += this.comprar.primera;
                    DataRow fila = this.dt.NewRow();
                    this.LlenarFilaComprar(fila);
                    this.dt.Rows.Add(fila);
                    this.dt.AcceptChanges();
                    if (this.acces.InsertarJugada(this.comprar.primera) == false)
                    {
                        MessageBox.Show("Problemas al conectar con base de datos");
                    }
                }
            }
        }
Exemplo n.º 6
0
        public string UpdateInfo(string idNum, string namecn, string nametw, string nameen, string nameth, string nametv, string display, string address, string ord, string ip)
        {
            if (Session[Util.ProjectConfig.ADMINUSER] == null)
            {
                return("");
            }

            DateTime time    = DateTime.Now;
            Casino   webInfo = new Casino();

            webInfo.Id      = int.Parse(idNum);
            webInfo.Namecn  = namecn;
            webInfo.Nameen  = nameen;
            webInfo.Nameth  = nameth;
            webInfo.Nametv  = nametv;
            webInfo.Nametw  = nametw;
            webInfo.Display = byte.Parse(display);
            webInfo.Address = address;
            webInfo.Path    = "none";
            webInfo.Ord     = byte.Parse(ord);
            //webInfo.operat = "admin";
            //webInfo.operatortime = time;
            //webInfo.operatorip = ip;
            return(CasinoManager.UpdateCasino(webInfo).ToString());
        }
Exemplo n.º 7
0
		public void CanGetEmptyCollection()
		{
			using (var store = NewDocumentStore())
			{
				new CasinosSuspensionsIndex().Execute(store);

				using (var documentSession = store.OpenSession())
				{

					var casino = new Casino("cities/1", "address", "name")
					{
						Suspensions = new List<Suspension>()
						{
							new Suspension(DateTime.UtcNow, new List<Exemption>())
						}
					};
					documentSession.Store(casino);
					documentSession.SaveChanges();

					var suspensions = documentSession.Query<CasinosSuspensionsIndex.IndexResult, CasinosSuspensionsIndex>().
						Customize(x=>x.WaitForNonStaleResults()).
						Where(x => x.CityId == "cities/1").
						OrderByDescending(x => x.DateTime).
						Take(10).
						AsProjection<CasinosSuspensionsIndex.IndexResult>().
						ToList();

					Assert.True(suspensions.All(x => x.Exemptions != null));
				}
			}
		}
Exemplo n.º 8
0
        public void GivenACasinoWithATable_WhenGetTable_ThenTheTableIsReturned()
        {
            var casino = new Casino();
            var id     = casino.CreateTable();
            var table  = casino.GetTable(id);

            table.Should().NotBeNull();
        }
Exemplo n.º 9
0
        /* public DataTable loginUser(Information info)
         * {
         *  SqlCommand cmd = new SqlCommand();
         *  cmd.CommandType = CommandType.Text;
         *  cmd.CommandText = "SELECT * FROM userData WHERE Username='******' and Password='******'";
         *  return db.ExeReader(cmd);
         * } */

        public DataTable loginCasino(Casino casino)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT * FROM casinoData WHERE OwnerName='" + casino.username + "'";
            return(db.ExeReader(cmd));
        }
Exemplo n.º 10
0
        public void CanCreateGameWithTwoDice()
        {
            var croupier = new Croupier();
            var casino   = new Casino();

            var game = croupier.CreateTwoDiceGame(casino);

            Assert.AreEqual(2, game.RollCount);
        }
Exemplo n.º 11
0
        public void WhenCheckNot5xBet_ShouldNotBeAllow()
        {
            var casino = new Casino();
            var bet    = new Bet(6, 1);

            var allowedBets = casino.AcceptBets(bet);

            Assert.Empty(allowedBets);
        }
Exemplo n.º 12
0
        public void WhenBuyChips_ShouldAddThemToAvailableChips()
        {
            var player = new Player();
            var casino = new Casino();

            player.Buy(casino, 6);

            Assert.Equal(6, player.AvailableChips);
        }
Exemplo n.º 13
0
        public void ArgumentExceptionIsThrown_WhenBettingScoreIsGreaterThanTwelveInTwoDiceGame()
        {
            var casino       = new Casino();
            var game         = casino.CreateGame(new Die(), 2);
            var player       = Create.Player.InCasino(casino).InGame(game).WithChips(100).Please();
            var invalidScore = 13;

            Assert.ThrowsException <ArgumentException>(() => player.MakeBetOn(1, invalidScore));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Evento que al dar doble click en una fila de la datatable me muestre la billetera actual de ese jugador
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DobleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int     i       = this.dtaGridView.SelectedRows[0].Index;
            DataRow fila    = this.dt.Rows[i];
            string  dni     = fila[0].ToString();
            Jugador buscado = Casino.BuscarJugador(this.empresa, dni);

            MessageBox.Show(buscado.ToString());
        }
Exemplo n.º 15
0
        /* public int insertUser(Information info)
         * {
         *  SqlCommand cmd = new SqlCommand();
         *  cmd.CommandType = CommandType.Text;
         *  cmd.CommandText = "INSERT INTO userData (FirstName, LastName, Username, Password, IsAdmin) VALUES ('" + info.firstname + "','" + info.lastname + "','" + info.username + "','" + info.password + "','" + info.isadmin + "')";
         *  return db.ExeNonQuery(cmd);
         * } */

        public int insertCasino(Casino casino)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "INSERT INTO casinoDATA (CasinoName, ClubName, CasinoLocation, OwnerFirstName, OwnerLastName, OwnerEmail, Username, Password, UserGuid) " +
                              "VALUES ('" + casino.casinoname + "','" + casino.clubname + "','" + casino.casinolocation + "','" + casino.firstname + "','" + casino.lastname + "'," +
                              "'" + casino.email + "','" + casino.username + "','" + casino.password + "','" + casino.userguid + "')";
            return(db.ExeNonQuery(cmd));
        }
Exemplo n.º 16
0
        public void HasRequestedChipsCount_WhenBoughtChipsFromCasino()
        {
            var player        = new Player();
            var requestAmount = 42;
            var casino        = new Casino();

            player.BuyFromCasino(requestAmount, casino);

            Assert.AreEqual(requestAmount, player.Chips);
        }
Exemplo n.º 17
0
        public void GivenACasinoWithATableWithOnePlayer_WhenRemovePlayer_ThenThatTableIsRemoved()
        {
            var casino = new Casino();
            var id     = casino.CreateTable();
            var table  = casino.GetTable(id);

            table.AddPlayer("Phil");
            casino.RemovePlayer("Phil");
            casino.GetTable(id).Should().BeNull();
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            double myPurse = 1000;

            Casino LasVegas = new Casino();

            LasVegas.SelectTable(myPurse);

            Console.ReadKey();
        }
Exemplo n.º 19
0
        public void WhenCheck5xBet_ShouldBeAllow()
        {
            var casino = new Casino();
            var bet    = new Bet(5, 1);

            var allowedBets = casino.AcceptBets(bet);

            Assert.Single(allowedBets);
            Assert.Contains(bet, allowedBets);
        }
Exemplo n.º 20
0
        public void Agregar_JugadorCasino()
        {
            Casino  casino = new Casino();
            Jugador player = new Jugador(1);

            casino += player;
            casino += player;

            Assert.AreEqual(casino.Jugadores.Count, 1);
        }
Exemplo n.º 21
0
        public void InvalidOperationIsThrown_WhenMoreThanSixPlayersJoin()
        {
            var game = new Casino().CreateGame(new Die());

            for (int i = 1; i <= 6; ++i)
            {
                new Player().Join(game);
            }

            Assert.ThrowsException <InvalidOperationException>(() => { new Player().Join(game); });
        }
Exemplo n.º 22
0
        public void GivenACasino_WhenCreatTable_ThenANewUniqueTableIdIsReturned()
        {
            var ids    = new List <int>();
            var casino = new Casino();

            for (int i = 0; i < 10; i++)
            {
                ids.Add(casino.CreateTable());
            }
            Assert.True(ids.Distinct().Count() == ids.Count());
        }
Exemplo n.º 23
0
        public void GivenACasino_WhenRemovePlayerThatDoesNotExist_ThenNothingHappens()
        {
            var casino = new Casino();
            var id     = casino.CreateTable();

            casino.GetTable(id).AddPlayer("Daniel");
            casino.RemovePlayer("Phil");
            var table = casino.GetTable(id);

            table.Should().NotBeNull();
        }
Exemplo n.º 24
0
        public void GivenACasinoWithSomeTablesWithPlayers_WhenGetTablesForPlayer_ThenTheCorrectTablesAreReturned()
        {
            var casino = new Casino();
            var id1    = casino.CreateTable();
            var id2    = casino.CreateTable();
            var id3    = casino.CreateTable();

            casino.GetTable(id1).AddPlayer("Phil");
            casino.GetTable(id2).AddPlayer("Daniel");
            casino.GetTable(id3).AddPlayer("Phil");
            casino.GetTablesFor("Phil").Should().BeEquivalentTo(new [] { id1, id3 });
        }
Exemplo n.º 25
0
 ///<sumary>
 ///修改信息
 ///时间:2010-9-12 14:24:06
 ///</sumary>
 public static Boolean UpdateCasino(Casino casino)
 {
     try
     {
         return(casinoService.UpdateCasino(casino));
     }
     catch (Exception ex)
     {
         //可以记录到异常日志
         return(false);
     }
 }
Exemplo n.º 26
0
        public void ArgumentExceptionIsThrown_WhenValidatedBetIsNotMultipleOfFive()
        {
            var casino = new Casino();
            var bets   = Enumerable
                         .Range(1, 100)
                         .Where(bet => bet % 5 != 0);

            foreach (var bet in bets)
            {
                Assert.ThrowsException <ArgumentException>(() => casino.ValidateBet(bet));
            }
        }
Exemplo n.º 27
0
        public void ChipsCountUnchanged_WhenLostTheGame()
        {
            var casino           = new Casino();
            var die              = Create.Die.Rolling(1).Please();
            var game             = casino.CreateGame(die);
            int chipsAmount      = 100;
            var player           = Create.Player.InCasino(casino).InGame(game).WithChips(chipsAmount).Betting(chipsAmount).On(2).Please();
            var formerChipsCount = player.Chips;

            game.Run();

            Assert.AreEqual(formerChipsCount, player.Chips);
        }
Exemplo n.º 28
0
        public void GivenACasinoWith10Tables_WhenCreateTable_AnExceptionIsThrown()
        {
            var casino = new Casino();

            for (int i = 0; i < 10; i++)
            {
                casino.CreateTable();
            }

            Action action = () => casino.CreateTable();

            action.ShouldThrow <Exception>().WithMessage("Reached the maximum of 10 tables.");
        }
Exemplo n.º 29
0
        public Casino Get(int casino)
        {
            Casino data = null;
            string sql  = "SELECT * FROM Casino WHERE CasinoID = @CasinoID";

            data = _data.Get <Casino>(sql, new { CasinoID = casino });
            if (data != null)
            {
                string t_sql = "SELECT * from ClubLevel Where CasinoID = @CasinoID ORDER BY Sort";
                data.ClubLevels = _data.List <ClubLevel>(t_sql, new { CasinoID = casino });
            }
            return(data);
        }
Exemplo n.º 30
0
        public void ChipsCountIncreasedBySixTimesBetAmount_WhenWonTheGame()
        {
            var casino           = new Casino();
            var winningScore     = 1;
            var die              = Create.Die.Rolling(winningScore).Please();
            var game             = casino.CreateGame(die);
            int chipsAmount      = 100;
            var player           = Create.Player.InCasino(casino).InGame(game).WithChips(chipsAmount).Betting(chipsAmount).On(winningScore).Please();
            var formerChipsCount = player.Chips;

            game.Run();

            Assert.AreEqual(formerChipsCount + chipsAmount * 6, player.Chips);
        }
Exemplo n.º 31
0
    /*public int getBooth()
     * {
     *  int patate = Random.Range(0, allBooths.Count);
     *  int boothToSend = allBooths[patate];
     *  allBooths.RemoveAt(patate);
     *
     *  return boothToSend;
     * }*/

    public BaseBooth getFaceDowbBooth()
    {
        int patate = Random.Range(0, allBooths.Count);
        int boothToSendFaceDown = allBooths[patate];

        allBooths.RemoveAt(patate);

        switch (boothToSendFaceDown)
        {
        case 0:
            Debug.Log("Restaurant,This restaurant adds 1 visitor to your parc and generate 2 $ per turn.");
            Restaurant restaurant = new Restaurant();
            restaurant.turnOver();
            return(restaurant);

        case 1:
            Debug.Log("Security, This guard is securing your park against dinosaur breaches.");
            Security security = new Security();
            security.turnOver();
            return(security);

        case 2:
            Debug.Log("Bathroom, This clean new bathroom brings 3 new visitors around your park.");
            Bathroom bathroom = new Bathroom();
            bathroom.turnOver();
            return(bathroom);

        case 3:
            Debug.Log("Casino, This arcade helps you generate 3 $ per turn.");
            Casino casino = new Casino();
            casino.turnOver();
            return(casino);

        case 4:
            Debug.Log("Spy, You have recruited ingenious spies to clone one of your enemy's dinosaur (single use effect).");
            Spy spy = new Spy();
            spy.turnOver();
            return(spy);

        case 5:
            Debug.Log("Paleontologist, You have recruited a wise paleontologist! He will help you counter some unfortunate events that could ruin your park.");
            Paleontologist paleontologist = new Paleontologist();
            paleontologist.turnOver();
            return(paleontologist);

        default:
            Debug.Log("invalid boothId");
            return(null);
        }
    }
Exemplo n.º 32
0
        /// <summary>
        /// Evento que al apretar el boton Jugar, abre otro form Juego, que modifica un row del Datatable con los
        /// datos generados en ese form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAJugar_Click(object sender, EventArgs e)
        {
            this.juego = new FormJugar(this.empresa);
            this.juego.ShowDialog();

            if (this.juego.segunda != null)
            {
                this.empresa += this.juego.segunda;
                DataRow filajuego = this.dt.Rows.Find(this.juego.victima.DNI);
                this.LlenarFilaJugar(filajuego);
                this.dt.AcceptChanges();
                this.acces.ModificarJuego(this.juego.segunda);
            }
        }
Exemplo n.º 33
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);
			int version = reader.ReadInt();
			m_Active = reader.ReadBool();
			m_Casino = (Casino)reader.ReadInt();
			m_CasinoName = reader.ReadString();
			m_TotalPlays = reader.ReadULong();
			m_TotalCollected = reader.ReadULong();
			m_TotalWon = reader.ReadULong();
			m_ErrorCode = reader.ReadInt();
			m_OrigHue = reader.ReadInt();

			m_InUseBy = reader.ReadMobile();
			m_OnCredit = reader.ReadInt();
			m_Escrow = reader.ReadInt();

			m_SecurityCamMobile = reader.ReadMobile();
			m_SecurityChatter = (VerboseType)reader.ReadInt();

			m_Bet = reader.ReadInt();
			m_TestMode = reader.ReadBool();

			m_DealerDelay = reader.ReadBool();
			m_DoubleAfterSplit = reader.ReadBool();
			m_DealerHitsSoft17 = reader.ReadBool();
			m_DealerTakesPush = reader.ReadBool();
			m_Resplits = reader.ReadBool();
			m_SplitAces = (SplitAces)reader.ReadInt();
			m_BJSplitAces21 = reader.ReadBool();
			m_BJSplitAcesPaysEven = reader.ReadBool();
			m_DoubleDown = (DoubleDown)reader.ReadInt();
			m_PlayerCardsFaceUp = reader.ReadBool();
			m_DealerCardsFaceUp = reader.ReadBool();
			m_NumberOfDecks = reader.ReadShort();
			m_ContinuousShuffle = reader.ReadBool();
			m_MinBet = (BetValues)reader.ReadInt();
			m_MaxBet = (BetValues)reader.ReadInt();
			m_BlackJackPays = (BlackJackPays)reader.ReadInt();
			m_CardSounds = reader.ReadBool();
			carddeck = new CardDeck(m_NumberOfDecks,0);
			m_BJInfo.HandInfo = new HandStruct[5];
			for (int h = 0; h < 5; h++)
			{
				m_BJInfo.HandInfo[h].bet = 0;
				m_BJInfo.HandInfo[h].totalcards = 0;
				m_BJInfo.HandInfo[h].card = new short[12];
				for (int c = 0; c < 12; c++)
					m_BJInfo.HandInfo[h].card[c] = -1;
				m_BJInfo.HandInfo[h].bestscore = 0;
				m_BJInfo.HandInfo[h].altscore = 0;
			}
		}