public void GameBoardGridTest() { List<GameBoardSquare> squaresList = new List<GameBoardSquare>(); for (int y = 0; y < 15; ++y) { for (int x = 0; x < 15; ++x) { squaresList.Add(new GameBoardSquare(x, y, 1, 1)); } } Board.GameBoardSquareGrid boardGrid = new Board.GameBoardSquareGrid(squaresList); try { boardGrid[7, 7] = new GameBoardSquare(8, 8, 3, 1); } catch { Assert.Fail(); } Assert.IsTrue(boardGrid[7, 7].CoordinateX == 8 && boardGrid[7, 7].CoordinateY == 8); }
public void RemoveScoreMultipliersTest() { GameBoardSquare gbs = new GameBoardSquare(0, 0, 3, 1); gbs.RemoveScoreMultipliers(); Assert.IsTrue(gbs.LetterMultiplier == 1 && gbs.WordMultiplier == 1); gbs = new GameBoardSquare(0, 0, 1, 3); gbs.RemoveScoreMultipliers(); Assert.IsTrue(gbs.LetterMultiplier == 1 && gbs.WordMultiplier == 1); }
public void RemoveLetterTileTest() { GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1); LetterTile lt1 = new LetterTile('A', 1); gbs.InsertLetterTile(lt1); Assert.IsFalse(gbs.IsEmpty()); LetterTile lt2 = gbs.RemoveLetterTile(); Assert.IsTrue(gbs.IsEmpty()); }
public void GameBoardSquareTest() { bool exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsFalse(exceptionWasThrown); exceptionWasThrown = false; GameBoardSquare gbsCenter = new GameBoardSquare(7, 7, 1, 1); Assert.IsTrue(gbsCenter.IsStartSquare); try { GameBoardSquare gbs = new GameBoardSquare(14, 14, 1, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsFalse(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(-1, 0, 1, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, -1, 1, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(15, 0, 1, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, 15, 1, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, 0, 2, 2); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, 0, 4, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 4); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, 0, 0, 1); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; try { GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 0); } catch (Exception) { exceptionWasThrown = true; } Assert.IsTrue(exceptionWasThrown); exceptionWasThrown = false; }
public void IsEmptyTest() { LetterTile lt = new LetterTile('n', 0); GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1); Assert.IsTrue(gbs.IsEmpty()); Assert.IsTrue(gbs.ContainedLetterTile.Equals(lt)); lt = new LetterTile('A', 1); gbs.InsertLetterTile(lt); Assert.IsFalse(gbs.IsEmpty()); Assert.IsFalse(gbs.ContainedLetterTile.Equals(new LetterTile('n', 0))); }
public void InsertLetterTileTest() { GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1); LetterTile lt = new LetterTile('A', 1); gbs.InsertLetterTile(lt); Assert.IsFalse(gbs.IsEmpty()); }
public void RemoveLetterTileTest() { GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1); LetterTile lt1 = new LetterTile('A', 1); gbs.InsertLetterTile(lt1); Assert.IsFalse(gbs.IsEmpty()); LetterTile lt2 = gbs.RemoveLetterTile(); Assert.IsTrue(gbs.IsEmpty()); bool exceptionWasThrown = false; try { lt2 = gbs.RemoveLetterTile(); } catch (GameBoardSquare.InvalidGameBoardSquareConfigurationException e) { exceptionWasThrown = true; Assert.IsTrue(e.ToString() == "InvalidGameBoardSquareConfigurationException: Invalid removal of LetterTile from an already empty GameBoardSquare object."); } Assert.IsTrue(exceptionWasThrown); }
public void InsertLetterTileTest() { GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1); LetterTile lt = new LetterTile('A', 1); gbs.InsertLetterTile(lt); Assert.IsFalse(gbs.IsEmpty()); bool exceptionsWasThrown = false; try { gbs.InsertLetterTile(lt); } catch (GameBoardSquare.InvalidGameBoardSquareConfigurationException e) { exceptionsWasThrown = true; Assert.IsTrue(e.ToString() == "InvalidGameBoardSquareConfigurationException: Invalid insertion of LetterTile object into GameBoardSquareObject."); } Assert.IsTrue(exceptionsWasThrown); }
public void GetCoordinatesTest() { GameBoardSquare gbs = new GameBoardSquare(5, 3, 1, 1); Assert.IsTrue(gbs.CoordinateY == 3); Assert.IsTrue(gbs.CoordinateX == 5); }