public void ShouldReturnBlock()
        {
            BlockFactory blockFactory = new BlockFactory();

            IBlock block = blockFactory.MakeBlock();

            Assert.IsInstanceOf<Block>(block);
        }
예제 #2
0
 public void RotateRight_Rotate360_TetrominoIsInOriginalForm()
 {
     var stubFactory = new StubBlockFactory();
     var factory = new BlockFactory();
     foreach (var tetrominoDefinition in factory.TetrominoDefinitions)
     {
         var initialTetrominoGrid = tetrominoDefinition.Grid;
         var block = stubFactory.MakeBlock(new Color(), initialTetrominoGrid);
         for (var i = 0; i < 4; i++)
             block.RotateRight();
         Assert.AreEqual(initialTetrominoGrid, block.TetrominoGrid);
     }
 }
예제 #3
0
 public void BadPositionTest( int x, int y )
 {
     IField field = new Field( 10, 10 );
     IBlock block = new BlockFactory().MakeBlock();
     field.SetBlock( block, new Point( 5, 5 ) );
     try
     {
         if ( field.Checker.Check( field, block, x, y ) )
         {
             throw new Exception( string.Format( "bad position has succeeded: x: {0}, y: {1}", x, y ) );
         }
     }
     catch ( FieldException )
     {
     }
 }
예제 #4
0
 public void PositionTest( int x, int y )
 {
     IField field = new Field( 10, 10 );
     IBlock block = new BlockFactory().MakeBlock();
     field.SetBlock( block, new Point( x, y ) );
     field.Checker.Check( field, block, x, y );
 }