public void GetNextRoutes_Should_Return_Null_If_Current_Is_At_Destination()
        {
            var context = new MazeCrawlerContext
            {
                Start         = new Coordinates(6, 4),
                Destination   = new Coordinates(6, 4),
                NavigationMap = new Map(new char[0][]),
                Coordinator   = Substitute.For <IMazeCrawlerCoordinator>()
            };
            var crawler = new MazeCrawler(context);

            crawler.GetNextRoutes().Should().BeNull();
        }
        public void GetNextRoutes_Should_Return_Directions_Based_On_Preference(int startX, int startY, int destinationX, int destinationY, Direction[] expected)
        {
            var context = new MazeCrawlerContext
            {
                Start         = new Coordinates(startX, startY),
                Destination   = new Coordinates(destinationX, destinationY),
                NavigationMap = new Map(new char[][]
                {
                    new char[] { Map.EMPTY, Map.EMPTY, Map.EMPTY },
                    new char[] { Map.EMPTY, Map.EMPTY, Map.EMPTY },
                    new char[] { Map.EMPTY, Map.EMPTY, Map.EMPTY }
                }),
                Coordinator = Substitute.For <IMazeCrawlerCoordinator>()
            };
            var crawler = new MazeCrawler(context);

            var routes = crawler.GetNextRoutes();

            routes.Should().HaveSameCount(expected);
            routes.Should().Equal(expected);
        }
        public void GetNextRoutes_Should_Return_Empty_If_There_Are_No_Available_Routes()
        {
            var context = new MazeCrawlerContext
            {
                Start         = new Coordinates(0, 1),
                Destination   = new Coordinates(2, 3),
                NavigationMap = new Map(new char[][]
                {
                    new char[] { Map.OCCPD, Map.OCCPD, Map.EMPTY },
                    new char[] { Map.EMPTY, Map.OCCPD, Map.EMPTY },
                    new char[] { Map.OCCPD, Map.OCCPD, Map.EMPTY },
                    new char[] { Map.EMPTY, Map.EMPTY, Map.EMPTY }
                }),
                Coordinator = Substitute.For <IMazeCrawlerCoordinator>()
            };
            var crawler = new MazeCrawler(context);

            var routes = crawler.GetNextRoutes();

            routes.Should().BeEmpty();
        }
        public void GetNextRoutes_Should_Return_Directions_Based_On_Availability(int startX, int startY, int destinationX, int destinationY, Direction expected)
        {
            var context = new MazeCrawlerContext
            {
                Start         = new Coordinates(startX, startY),
                Destination   = new Coordinates(destinationX, destinationY),
                NavigationMap = new Map(new char[][]
                {
                    new char[] { Map.OCCPD, Map.OCCPD, Map.EMPTY, Map.OCCPD },
                    new char[] { Map.EMPTY, Map.EMPTY, Map.EMPTY, Map.OCCPD },
                    new char[] { Map.OCCPD, Map.EMPTY, Map.EMPTY, Map.EMPTY },
                    new char[] { Map.OCCPD, Map.EMPTY, Map.OCCPD, Map.OCCPD }
                }),
                Coordinator = Substitute.For <IMazeCrawlerCoordinator>()
            };
            var crawler = new MazeCrawler(context);

            var routes = crawler.GetNextRoutes();

            routes.Should().HaveCount(1);
            routes.First().Should().Be(expected);
        }