public void TestCheckIfCommandIsCoordinateTwoOne() { PlayField field = new PlayField(3, 4); CommandParser parser = new CommandParser(); bool isCoordinate = parser.CheckIfCommandIsCoordinate("2, , 1", field); Assert.AreEqual(true, isCoordinate); }
public void TestCheckIfCommandIsCoordinateIsCoordinateSevenFiveComma() { PlayField field = new PlayField(3, 4); CommandParser parser = new CommandParser(); bool isCoordinate = parser.CheckIfCommandIsCoordinate("7, 5", field); Assert.AreEqual(false, isCoordinate); }
public void TestCheckIfCommandIsCoordinateNegative() { PlayField field = new PlayField(3, 4); CommandParser parser = new CommandParser(); bool isCoordinate = parser.CheckIfCommandIsCoordinate("-4, , -5", field); Assert.AreEqual(false, isCoordinate); }
public void TestClearLevelNotEmpty() { PlayField field = new PlayField(5, 5, 20); field.MakeChangesToField(0, 0); bool allBubblesPopped = field.ClearedLevel(); Assert.AreEqual(false, allBubblesPopped); }
public void TestClearLevelEmpty() { PlayField field = new PlayField(5, 5, 1); field.MakeChangesToField(2, 2); bool allBubblesPopped = field.ClearedLevel(); Assert.AreEqual(true, allBubblesPopped); }
public void TestPlayFieldConstructorMaxBubbleNumberOne() { PlayField field = new PlayField(3, 4, 1); bool allBubblesValid = true; for (int i = 0; i < field.GetLength(0); i++) { for (int j = 0; j < field.GetLength(1); j++) { if (field[i, j]!= 1) { allBubblesValid = false; break; } } } Assert.AreEqual(3, field.GetLength(0)); Assert.AreEqual(4, field.GetLength(1)); Assert.AreEqual(true, allBubblesValid); }
public void TestMakeChangesToField() { PlayField field= new PlayField(5,5,1); field.MakeChangesToField(2,2); bool allBubblesPopped = true; for (int i = 0; i < field.GetLength(0); i++) { for (int j = 0; j < field.GetLength(1); j++) { if (field[i,j]!=0) { allBubblesPopped=false; break; } } } Assert.AreEqual(true, allBubblesPopped); }
public void TestCheckIfPoppableBallonsNotPoppable() { PlayField field = new PlayField(3, 3, 1); field.MakeChangesToField(1, 1); CommandParser parser = new CommandParser(); int countPopped=0; for (int i = 0; i < field.GetLength(0); i++) { for (int j = 0; j < field.GetLength(1); j++) { if (!parser.CheckPoppableBalloon( i.ToString()+" "+j.ToString(), field)) { countPopped++; } } } Assert.AreEqual(9, countPopped); }
public void TestParseCommandTop() { PlayField field = new PlayField(3, 4); CommandParser parser = new CommandParser(); Command command = parser.ParseCommand("Top", field); Assert.AreEqual(Command.Top, command); }
public void TestParseCommandRestart() { PlayField field = new PlayField(3, 4); CommandParser parser = new CommandParser(); Command command = parser.ParseCommand("Restart", field); Assert.AreEqual(Command.Restart, command); }
public void TestParseCommandExitFirstLetterLowerCase() { PlayField field = new PlayField(3, 4); CommandParser parser = new CommandParser(); Command command = parser.ParseCommand("exit", field); Assert.AreEqual(Command.Invalid, command); }
public void TestPlayFieldConstructorZeroCol() { PlayField field = new PlayField(1, 0, 2); }
public void TestGetLengthArgumentZeroFieldFourRowsThreeCols() { PlayField field=new PlayField(4,3); int rows=field.GetLength(0); Assert.AreEqual(4,rows); }
public void TestGetLengthArgumentTwoFieldFourRowsThreeCols() { PlayField field = new PlayField(4, 3); int cols = field.GetLength(2); Assert.AreEqual(3, cols); }
public void TestPlayFieldConstructorZeroRow() { PlayField field = new PlayField(0, 3, 2); }
public void TestParseCommandCoordinateForParsing() { PlayField field = new PlayField(3, 4); CommandParser parser = new CommandParser(); Command command = parser.ParseCommand("2 3", field); Assert.AreEqual(Command.CoordinateForParsing, command); }
public void TestCheckIfPoppableBallonsPoppable() { PlayField field = new PlayField(3, 3); CommandParser parser=new CommandParser(); bool isPoppable = parser.CheckPoppableBalloon("2 1", field); Assert.AreEqual(true, isPoppable); }
public void TestPlayFieldConstructorNegativeMaxBubbleNumber() { PlayField field = new PlayField(3, 4, 0); }