Add test for nextAvailableCellInDirection method within GridManager. Pass test.
Remove redundant checking.
Fix logic order error.