public void Uncover_OnNoMine_ReturnsRightAmountOfAdjacentMines(MinefieldTestData testdata) { Minefield minefieldUnderTest = new(3, 3, 0, new MinelayerToTest(testdata.MineLocations)); IGameUpdateReport result = minefieldUnderTest.Uncover(1, 1); result.Cells.Should().NotBeEmpty() .And.ContainSingle(cell => cell.AdjacentMineCount == testdata.MineLocations.Count); }
public void MinefieldUncover_Should_ReturnAtLeastTheClickedLocation() { Minefield minefieldUnderTest = new(5, 7, 11, new RandomMinelayer(new GuidLocationShuffler())); Location locationTestValue = new(3, 4); IGameUpdateReport result = minefieldUnderTest.Uncover(locationTestValue); result.Cells.Should().NotBeEmpty() .And.ContainSingle(cell => cell.Location == locationTestValue); }
public void Uncover_OnLastCellWithoutMine_ReturnsNoMineAndGameWon() { Location mineLocation = new(1, 0); Minefield minefieldUnderTest = new(2, 1, 1, new MinelayerToTest(mineLocation)); IGameUpdateReport result = minefieldUnderTest.Uncover(0, 0); result.Cells.Should().NotBeEmpty() .And.ContainSingle(cell => !cell.IsMine); result.Status.Should().Be(GameStatus.IsWon); }
public void Uncover_OnCellWithoutMine_GameStillInProgress() { Location mineLocation = new(1, 0); Minefield minefieldUnderTest = new(3, 1, 1, new MinelayerToTest(mineLocation)); IGameUpdateReport result = minefieldUnderTest.Uncover(0, 0); result.Cells.Should().NotBeEmpty() .And.Contain(cell => !cell.IsMine); result.Status.Should().Be(GameStatus.InProgress); }
internal GameUpdater WithReport(IGameUpdateReport report) { Report = report; return(this); }