Esempio n. 1
0
        public void WhenACoordinateHasBeenExploredThenIsExploredIsTrue()
        {
            var minefield         = Minefield.Empty(2, 3);
            var coordinate        = new Coordinates(0, 1);
            var exploredMinefield = minefield.Explore(coordinate);

            Assert.AreEqual(true, exploredMinefield.IsExplored(coordinate.RowIndex, coordinate.ColumnIndex));
        }
Esempio n. 2
0
        public void InitiallyAllMineLocationsUnexplored()
        {
            var minefield = Minefield.Empty(2, 3);

            Assert.AreEqual(false, minefield.IsExplored(0, 0));
            Assert.AreEqual(false, minefield.IsExplored(2, 1));
            Assert.AreEqual(false, minefield.IsExplored(1, 1));
        }
Esempio n. 3
0
        public void ExploreDifferentRowsOnce()
        {
            var       minefield                = Minefield.Empty(2, 3);
            Minefield exploredMinefield        = minefield.Explore(new Coordinates(0, 1));
            Minefield furtherExploredMinefield = exploredMinefield.Explore(new Coordinates(1, 0));

            Assert.AreEqual(true, furtherExploredMinefield.IsExplored(1, 0));
            Assert.AreEqual(true, furtherExploredMinefield.IsExplored(0, 1));
        }
Esempio n. 4
0
        public void ExploringARowTwiceWorks()
        {
            var       minefield                = Minefield.Empty(2, 3);
            Minefield exploredMinefield        = minefield.Explore(new Coordinates(0, 1));
            Minefield furtherExploredMinefield = exploredMinefield.Explore(new Coordinates(0, 0));

            Assert.AreEqual(true, furtherExploredMinefield.IsExplored(0, 0));
            Assert.AreEqual(true, furtherExploredMinefield.IsExplored(0, 1));
        }
Esempio n. 5
0
        public void UnexploredSquaresAreShownAsHashes()
        {
            // Given
            var minefield = Minefield.Empty(3, 2);
            // When
            var result = MinefieldRenderer.RenderMinefield(minefield);
            // Then
            var expected = " 123\nA###\nB###\n";

            Assert.AreEqual(expected, result);
        }
Esempio n. 6
0
        public void ExploredSquaresAreShownAsSpaces()
        {
            // Given
            var minefield = Minefield.Empty(3, 2).Explore(new Coordinates(0, 1));
            // When
            var result = MinefieldRenderer.RenderMinefield(minefield);
            // Then
            var expected = " 123\nA# #\nB###\n";

            Assert.AreEqual(expected, result);
        }