public void Test_EraseBotType() { IPokerDatabase database = new PokerDatabase(); int numberOfBots = 5; for (int i = 0; i < numberOfBots; i++) { IPlayer currentPlayer = new Player(i.ToString()); currentPlayer.Type = 1000; database.AddBot(currentPlayer); } IBotEraser eraser = new BotEraser(); eraser.EraseBotType(database); bool isTypeErased = true; for (int i = 0; i < numberOfBots; i++) { if (database.TakeBotByIndex(i).Type != PokerGameConstants.PlayerDefaultType) { isTypeErased = false; break; } } Assert.IsTrue(isTypeErased, "Bots type is not erased."); }
public void Test_DisableBots() { IPokerDatabase database = new PokerDatabase(); int numberOfBots = 5; for (int i = 0; i < numberOfBots; i++) { IPlayer currentPlayer = new Player(i.ToString()); currentPlayer.CanPlay = true; database.AddBot(currentPlayer); } IBotEraser eraser = new BotEraser(); eraser.DisableBots(database); bool areAllDisabled = true; for (int i = 0; i < numberOfBots; i++) { if (database.TakeBotByIndex(i).CanPlay) { areAllDisabled = false; break; } } Assert.IsTrue(areAllDisabled, "Bots are not disabled."); }
public void Test_TakeBotByIndex_IndexGreaterThanTheBotCollection() { IPokerDatabase database = new PokerDatabase(); IPlayer testBot = new Player("Test Bot"); database.AddBot(testBot); IPlayer currentBot = database.TakeBotByIndex(1); }
public void Test_TakeBotByIndex_NegativeIndex() { IPokerDatabase database = new PokerDatabase(); IPlayer testBot = new Player("Test Bot"); database.AddBot(testBot); IPlayer currentBot = database.TakeBotByIndex(-1); }
public void Test_AddBot() { IPokerDatabase database = new PokerDatabase(); IPlayer testBot = new Player("Test Bot"); database.AddBot(testBot); Assert.AreEqual(1, database.BotsCount(), "The bot was not added to the collection."); }
public void Test_AddBotDuplicateException() { IPokerDatabase database = new PokerDatabase(); IPlayer testBot = new Player("Test Bot"); IPlayer duplicateBot = new Player("Test Bot"); database.AddBot(testBot); database.AddBot(duplicateBot); }
public void Test_TakeBotByIndex() { IPokerDatabase database = new PokerDatabase(); IPlayer testBot = new Player("Test Bot"); database.AddBot(testBot); IPlayer currentBot = database.TakeBotByIndex(0); Assert.AreEqual(currentBot, testBot, "The take bot by index method does not work correctly."); }
public void Test_UnFoldBots() { IPokerDatabase database = new PokerDatabase(); int numberOfBots = 5; for (int i = 0; i < numberOfBots; i++) { IPlayer currentPlayer = new Player(i.ToString()); currentPlayer.Folded = true; database.AddBot(currentPlayer); } IBotEraser eraser = new BotEraser(); eraser.UnFoldBots(database); bool areAllFolded = true; for (int i = 0; i < numberOfBots; i++) { if (database.TakeBotByIndex(i).Folded != PokerGameConstants.PlayerDefaultFolded) { areAllFolded = false; break; } } Assert.IsTrue(areAllFolded, "Bot have folded."); }
public void Test_EnableBotChips() { IPokerDatabase database = new PokerDatabase(); int numberOfBots = 5; for (int i = 0; i < numberOfBots; i++) { IPlayer currentPlayer = new Player(i.ToString()); currentPlayer.OutOfChips = true; database.AddBot(currentPlayer); } IBotEraser eraser = new BotEraser(); eraser.EnableBotChips(database); bool areChipsEnabled = true; for (int i = 0; i < numberOfBots; i++) { if (database.TakeBotByIndex(i).OutOfChips != PokerGameConstants.PlayerDefaultOutOfChips) { areChipsEnabled = false; break; } } Assert.IsTrue(areChipsEnabled, "Bot chips are not enabled."); }
public void Test_PokerDatabaseInitialization() { IPokerDatabase database = new PokerDatabase(); Assert.AreEqual(0, database.BotsCount(), "The initial bot collection is not empty"); }