コード例 #1
0
        public void DigSquare_DigSquareWithMine()
        {
            var createGrid = new CreateGrid(_random);
            var grid       = createGrid.Create(2, 2, 2);
            var digSquare  = new DigSquare();

            Assert.False(digSquare.Dig(grid, 0, 0));
        }
コード例 #2
0
        public void DigSquare_DigSquareWhithoutMine()
        {
            var createGrid = new CreateGrid(_random);
            var grid       = createGrid.Create(2, 2, 2);
            var digSquare  = new DigSquare();

            Assert.True(digSquare.Dig(grid, 1, 1));
            Assert.False(grid.MineField[0, 0].IsUncovered);
            Assert.False(grid.MineField[0, 1].IsUncovered);
            Assert.False(grid.MineField[1, 0].IsUncovered);
            Assert.True(grid.MineField[1, 1].IsUncovered);
        }
コード例 #3
0
        public void IntegrationTest()
        {
            var createGrid     = new CreateGrid(_random);
            var checkSquare    = Substitute.For <ICheckSquare>();
            var digSquare      = new DigSquare();
            var flagSquare     = Substitute.For <IFlagSquare>();
            var userOperations = Substitute.For <IUserOperations>();

            userOperations.GetNumber("").ReturnsForAnyArgs((uint)2);
            var operations = new MineSweeperOperations(createGrid, checkSquare, digSquare, flagSquare, userOperations);

            userOperations.GetNumber("").ReturnsForAnyArgs((uint)1);
            Assert.True(operations.DigSquare());
        }