示例#1
0
        public void PrintStayInEveryTile()
        {
            // Given
            var goose   = new GooseGame(NUMBER_OF_TILES);
            var printer = new Mock <IGooseGamePrinter>();

            // When
            goose.Print(printer.Object);

            // Then
            printer.Verify(x => x.Print(It.IsAny <int>()), Times.Exactly(NUMBER_OF_TILES));
        }
示例#2
0
        public void PrintMoveForwardIfMultipleOf6()
        {
            // Given
            var goose = new GooseGame(NUMBER_OF_TILES)
                        .AddSpecialTile(new MoveForwardTile(MOVE_FORWARD_MULTIPLE, MOVE_FORWARD_STEPS));

            var printer = new Mock <IGooseGamePrinter>();

            // When
            goose.Print(printer.Object);

            // Then
            printer.As <IGooseGameSpecialTilePrinter>().Verify(x => x.Print(It.Is <int>(t => t % MOVE_FORWARD_MULTIPLE == 0), It.IsAny <MoveForwardTile>()), Times.Exactly(NUMBER_OF_TILES / MOVE_FORWARD_MULTIPLE));
        }
示例#3
0
        public void PrintStayInEveryTile()
        {
            // Given
            var goose   = new GooseGame(NUMBER_OF_TILES);
            var printer = new Mock <IGooseGamePrinter>();

            // When
            goose.Print(printer.Object);

            // Then
            for (int i = 1; i <= NUMBER_OF_TILES; ++i)
            {
                printer.Verify(x => x.Print(It.Is <int>(t => t == i)), Times.Once);
            }
        }
示例#4
0
        public void PrintTheHotelIfTileIs19()
        {
            // Given
            var goose = new GooseGame(NUMBER_OF_TILES)
                        .AddSpecialTile(new HotelTile(HOTEL_TILE))
                        .AddSpecialTile(new BridgeTile(BRIDGE_TILE, BRIDGE_DESTINATION_TILE))
                        .AddSpecialTile(new MoveForwardTile(MOVE_FORWARD_MULTIPLE, MOVE_FORWARD_STEPS));

            var printer = new Mock <IGooseGamePrinter>();

            // When
            goose.Print(printer.Object);

            // Then
            printer.As <IGooseGameSpecialTilePrinter>().Verify(x => x.Print(It.Is <int>(t => t == HOTEL_TILE), It.IsAny <HotelTile>()), Times.Once);
        }
示例#5
0
        public void PrintBridgeIfTileIsSix()
        {
            // Given
            var goose = new GooseGame(NUMBER_OF_TILES);

            goose.AddSpecialTile(new BridgeTile(BRIDGE_TILE, BRIDGE_DESTINATION_TILE));
            goose.AddSpecialTile(new MoveForwardTile(MOVE_FORWARD_MULTIPLE, MOVE_FORWARD_STEPS));

            var printer = new Mock <IGooseGamePrinter>();

            // When
            goose.Print(printer.Object);

            // Then
            printer.Verify(x => x.Print(It.Is <int>(t => t == BRIDGE_TILE), It.IsAny <BridgeTile>()), Times.Once);
            printer.Verify(x => x.Print(It.Is <int>(t => t == BRIDGE_TILE), It.IsAny <MoveForwardTile>()), Times.Never);
        }
示例#6
0
        public void PrintThePrisionIfTileIsBetween50And55()
        {
            // Given
            var goose = new GooseGame(NUMBER_OF_TILES)
                        .AddSpecialTile(new PrisionTile(PRISION_FROM_TILE, PRISION_TO_TILE))
                        .AddSpecialTile(new MazeTile(MAZE_TILE, MAZE_DESTINATION_TILE))
                        .AddSpecialTile(new WellTile(WELL_TILE))
                        .AddSpecialTile(new HotelTile(HOTEL_TILE))
                        .AddSpecialTile(new BridgeTile(BRIDGE_TILE, BRIDGE_DESTINATION_TILE))
                        .AddSpecialTile(new MoveForwardTile(MOVE_FORWARD_MULTIPLE, MOVE_FORWARD_STEPS));

            var printer = new Mock <IGooseGamePrinter>();

            // When
            goose.Print(printer.Object);

            // Then
            for (int i = PRISION_FROM_TILE; i <= PRISION_TO_TILE; ++i)
            {
                printer.As <IGooseGameSpecialTilePrinter>().Verify(x => x.Print(It.Is <int>(t => t == i), It.IsAny <PrisionTile>()), Times.Once);
            }
        }