public void FloorPlan_displays_agents()
        {
            var plan = new FloorPlan();            //NSubstitute.Substitute.For<FloorPlan>();

            plan.FloorTiles.AddRange(_FillArea(3, 1));

            plan.AddAgent("Test Agent", new Agent().Move(new Location(1, 0)));
            string display = plan.Print();

            Debug.Write(display);
            display.ShouldBeEquivalentTo("+@+" + Environment.NewLine);
        }
        public void FloorPlan_detects_agents()
        {
            FloorPlan plan = new FloorPlan();            //NSubstitute.Substitute.For<FloorPlan>();

            plan.FloorTiles.AddRange(_FillArea(30, 10, 1));
            plan.IsAgentOnTile(11, 4).Should().BeFalse();

            var agent = new Agent();            // NSubstitute.Substitute.For<IAgent>();

            agent.Move(new Location(11, 4));

            plan.AddAgent("Test Agent", agent);
            plan.IsAgentOnTile(11, 4).Should().BeTrue();

            plan.IsAgentOnTile(4, 11).Should().BeFalse();
        }
        public void Agents_attack_tiles()
        {
            RoomService roomService = NSubstitute.Substitute.For <RoomService>();
            var         plan        = new FloorPlan(3, 3, fill: true);

            var agent = new Agent();             //NSubstitute.Substitute.For<Agent>();

            agent.Move(new Location(1, 1));
            plan.AddAgent("Test Agent", agent);

            var tile = plan.GetFloorTile(2, 2);

            agent.AttackTile(tile).Should().BeFalse();

            tile      = plan.GetFloorTile(1, 2);
            tile.Cost = 2;
            agent.AttackTile(tile).Should().BeTrue();
            tile.Cost.Should().Be(1);

            agent.AttackTile(tile).Should().BeFalse();
            tile.Cost.Should().Be(1);
        }
        public void Agent_follows_path()
        {
            RoomService roomService = NSubstitute.Substitute.For <RoomService>();
            var         plan        = new FloorPlan(5, 4, fill: true);

            var agent = new Agent();            // NSubstitute.Substitute.For<Agent>();

            agent.Move(new Location(1, 1));
            plan.AddAgent("Test Agent", agent);

            NavigationService navService = NSubstitute.Substitute.For <NavigationService>(plan);

            agent.SetPath(navService.FindPath(agent.Point, new Location(3, 2)));

            var display = plan.Print(agent.Path);

            Debug.WriteLine(display);

            agent.Path.Count.ShouldBeEquivalentTo(3);

            display.ShouldBeEquivalentTo("+++++" + Environment.NewLine + "+@__+" + Environment.NewLine + "+_BC+"
                                         + Environment.NewLine + "+++++" + Environment.NewLine);

            agent.FollowPath(plan).Should().BeTrue();
            display = plan.Print(agent.Path);
            Debug.WriteLine(display);
            display.ShouldBeEquivalentTo("+++++" + Environment.NewLine + "+A__+" + Environment.NewLine + "+_@C+"
                                         + Environment.NewLine + "+++++" + Environment.NewLine);

            agent.FollowPath(plan).Should().BeTrue();
            display = plan.Print(agent.Path);
            Debug.WriteLine(display);
            display.ShouldBeEquivalentTo("+++++" + Environment.NewLine + "+A__+" + Environment.NewLine + "+_B@+"
                                         + Environment.NewLine + "+++++" + Environment.NewLine);

            agent.FollowPath(plan).Should().BeFalse();
        }