public void BattleFieldFrameworkConstructorDetonateMinesSize4() { BattleFieldFramework bf = new BattleFieldFramework(4); int exprected = 0; int actual = bf.DetonatedMines; Assert.AreEqual(exprected, actual); }
public void BattleFieldFrameworkConstructorSize4() { BattleFieldFramework bf = new BattleFieldFramework(4); int exprected = 4; int actual = bf.FieldSize; Assert.AreEqual(exprected, actual); }
public void BattleFieldFrameworkConstructorInitFieldSize4() { int size = 4; BattleFieldFramework bf = new BattleFieldFramework(size); string[,] actual = bf.Playground; string[,] exprected = { { " - ", " - ", " - ", " - " }, { " - ", " - ", " - ", " - " }, { " - ", " - ", " - ", " - " }, { " - ", " - ", " - ", " - " } }; this.AssertMatrixAreEqual(exprected, actual); }
public void BattleFieldFrameworkDetonateSize10Mine2() { BattleFieldFramework bf = new BattleFieldFramework(10); Random randomGenerator = new Random(256); int numberOfMines = bf.GetNumberOfMines(randomGenerator); string[,] playGround = bf.InitMines(randomGenerator, numberOfMines); string[,] actual = bf.DetonateMine(playGround, 6, 2); string[,] exprected = { { " 2 ", " - ", " - ", " - ", " - ", " 3 ", " - ", " - ", " 1 ", " - " }, { " 2 ", " - ", " - ", " - ", " - ", " - ", " - ", " - ", " - ", " - " }, { " - ", " - ", " 4 ", " - ", " 4 ", " - ", " - ", " - ", " - ", " - " }, { " - ", " - ", " - ", " - ", " - ", " - ", " - ", " - ", " - ", " - " }, { " - ", " 1 ", " - ", " - ", " - ", " - ", " - ", " 4 ", " 4 ", " 1 " }, { " - ", " X ", " X ", " X ", " - ", " - ", " - ", " - ", " - ", " - " }, { " - ", " X ", " X ", " X ", " - ", " - ", " 3 ", " - ", " - ", " - " }, { " - ", " X ", " X ", " X ", " - ", " 1 ", " - ", " - ", " - ", " - " }, { " - ", " 2 ", " 3 ", " 4 ", " - ", " - ", " 4 ", " - ", " - ", " - " }, { " - ", " - ", " - ", " - ", " - ", " - ", " - ", " 1 ", " - ", " - " }, }; AssertMatrixAreEqual(exprected, actual); }
public void BattleFieldFrameworkConstructorNegativeTest() { BattleFieldFramework bf = new BattleFieldFramework(0); }
public void BattleFieldFrameworkInitMinesSize5() { BattleFieldFramework bf = new BattleFieldFramework(5); Random randomGenerator = new Random(123); int numberOfMines = bf.GetNumberOfMines(randomGenerator); string[,] actual = bf.InitMines(randomGenerator, numberOfMines); string[,] exprected = { { " 4 ", " - ", " - ", " - ", " - " }, { " - ", " - ", " - ", " - ", " - " }, { " 5 ", " 1 ", " - ", " - ", " - " }, { " 1 ", " - ", " - ", " - ", " - " }, { " 1 ", " - ", " 1 ", " 5 ", " - " }, }; AssertMatrixAreEqual(exprected, actual); }
public void BattleFieldFrameworkGetNumberOfMinesSize5() { BattleFieldFramework bf = new BattleFieldFramework(5); Random randomGenerator = new Random(123); int actualeNumberOfMines = bf.GetNumberOfMines(randomGenerator); int expect = 7; Assert.AreEqual(expect, actualeNumberOfMines); }
public void BattleFieldFrameworkDetonateSize5Mine5After1() { BattleFieldFramework bf = new BattleFieldFramework(5); Random randomGenerator = new Random(123); int numberOfMines = bf.GetNumberOfMines(randomGenerator); string[,] playGround = bf.InitMines(randomGenerator, numberOfMines); string[,] first = bf.DetonateMine(playGround, 2, 1); string[,] actual = bf.DetonateMine(first, 4, 3); string[,] exprected = { { " 4 ", " - ", " - ", " - ", " - " }, { " X ", " - ", " X ", " - ", " - " }, { " 5 ", " X ", " X ", " X ", " X " }, { " X ", " X ", " X ", " X ", " X " }, { " 1 ", " X ", " X ", " X ", " X " }, }; this.AssertMatrixAreEqual(exprected, actual); }
public void BattleFieldFrameworkDetonateSize5GameOverCountUnopenMines() { BattleFieldFramework bf = new BattleFieldFramework(5); Random randomGenerator = new Random(123); int numberOfMines = bf.GetNumberOfMines(randomGenerator); string[,] playGround = bf.InitMines(randomGenerator, numberOfMines); string[,] first = bf.DetonateMine(playGround, 2, 1); string[,] second = bf.DetonateMine(first, 4, 3); string[,] third = bf.DetonateMine(second, 0, 0); string[,] actual = bf.DetonateMine(third, 4, 0); string[,] exprected = { { " X ", " X ", " X ", " - ", " - " }, { " X ", " X ", " X ", " - ", " - " }, { " X ", " X ", " X ", " X ", " X " }, { " X ", " X ", " X ", " X ", " X " }, { " X ", " X ", " X ", " X ", " X " }, }; AssertMatrixAreEqual(exprected, actual); Assert.AreEqual(0, bf.CountRemainingMines()); }
public void BattleFieldFrameworkDetonateSize1Mine5() { BattleFieldFramework bf = new BattleFieldFramework(1); Random randomGenerator = new Random(123); int numberOfMines = bf.GetNumberOfMines(randomGenerator); string[,] playGround = bf.InitMines(randomGenerator, numberOfMines); string[,] actual = bf.DetonateMine(playGround, 0, 0); string[,] exprected = { { " X " }, }; AssertMatrixAreEqual(exprected, actual); }