コード例 #1
0
ファイル: Program.cs プロジェクト: NanoMicroMan/PlayGround
 private static void Main(string[] args)
 {
     for (var i = 1; i < 66; i++)
     {
         GooseGame.PrintSpace(i);
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            var ui           = new GooseUserInterface();
            var boardFactory = new BoardFactory(BoardSpaces);
            var random       = new Random();
            var dice         = new DiceSixSides(random);
            var gooseGame    = new GooseGame(dice, boardFactory, ui);

            gooseGame.Create();
        }
コード例 #3
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));
        }
コード例 #4
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));
        }
コード例 #5
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);
            }
        }
コード例 #6
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);
        }
コード例 #7
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);
        }
コード例 #8
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);
            }
        }