public void NextDayTestZombie() { uint testrun = 10; uint size = 2; // Initialize to an appropriate size Board target = new Board(size); bool zombie = false; for (int i = 0; i < testrun; i++) { // Set board target.ChangeStatus(smallBoard); // Next day target.NextDay(); // Check if (target[0, 0] == null || target[1, 0] == null || target[0, 1] == null) { zombie = true; break; } } Assert.AreEqual(true, target[0, 0] == null || target[0, 0] == 1); Assert.AreEqual(true, target[0, 1] == null || target[0, 1] == 1); Assert.AreEqual(true, target[1, 0] == null || target[1, 0] == 1); Assert.AreEqual(null, target[1, 1]); Assert.IsTrue(zombie); }
public void ItemTest() { uint size = 2; // Initialize to an appropriate size Board target = new Board(size); target.ChangeStatus(smallBoard); Assert.AreEqual(1, target[0, 0]); Assert.AreEqual(1, target[0, 1]); Assert.AreEqual(1, target[1, 0]); Assert.AreEqual(null, target[1, 1]); }
public void NextDayTest() { uint size = 4; // Initialize to an appropriate size Board target = new Board(size); // Set board target.ChangeStatus(bigBoard); // Next day target.NextDay(); // Check Assert.AreEqual(1, target[0, 0]); Assert.AreEqual(1, target[0, 1]); Assert.AreEqual(0, target[0, 2]); Assert.AreEqual(null, target[0, 3]); Assert.AreEqual(1, target[1, 0]); Assert.AreEqual(0, target[1, 1]); Assert.AreEqual(0, target[1, 2]); Assert.AreEqual(0, target[1, 3]); Assert.AreEqual(0, target[2, 0]); Assert.AreEqual(0, target[2, 1]); Assert.AreEqual(0, target[2, 2]); Assert.AreEqual(0, target[2, 3]); Assert.AreEqual(0, target[3, 0]); Assert.AreEqual(0, target[3, 1]); Assert.AreEqual(0, target[3, 2]); Assert.AreEqual(null, target[3, 3]); }
public void ChangeStatusTest() { uint size = 8; // Initialize to an appropriate size Board target = new Board(size); Board.BoardEdit[] edits = { new Board.BoardEdit(1, 1, 1), // should change state new Board.BoardEdit(1, 2, 0), // should change state new Board.BoardEdit(2, 3, 3), // should not change state new Board.BoardEdit(3, 1, null), // should not change state new Board.BoardEdit(9, 6, 4), // out of range }; target.ChangeStatus(edits); Assert.AreEqual(1, target[1, 1]); Assert.AreEqual(0, target[1, 2]); Assert.AreEqual(null, target[2, 3]); Assert.AreEqual(null, target[3, 1]); // The last "test" should not throw an exception, but simply do nothing }