public void SupervisorNeedsToKnowAboutARobot ()
        {
            var arena = new RectangularArena(1, 1);
            var robot = new Robot("Will Smith", new Point(0, 0), 'N');
            var gameSupervisor = new GameSupervisor(arena);
            gameSupervisor.AddRobot(robot);

            Assert.NotNull(gameSupervisor.Robots);
        }
        public void RobotHasAName ()
        {
            var robot = new Robot("Bob", new Point(0, 0), 'N');

            Assert.Equal("Bob", robot.Name);
        }
        public void SupervisorCanHaveMultipleRobots ()
        {
            var arena = new RectangularArena(1, 1);
            var robot = new Robot("Will Smith", new Point(0, 0), 'N');
            var gameSupervisor = new GameSupervisor(arena);
            gameSupervisor.AddRobot(robot);
            var robot2 = new Robot("Jaden Smith", new Point(0, 0), 'N');
            gameSupervisor.AddRobot(robot2);

            Assert.True(gameSupervisor.Robots.Exists(x => x.Name == "Will Smith"));
            Assert.True(gameSupervisor.Robots.Any(x => x.Name == "Jaden Smith"));
        }
 internal void AddRobot (Robot robot)
 {
     if (this.Robots == null)
     {
         this.Robots = new List<Robot>();
     }
     this.Robots.Add(robot);
 }
 public void AddingARobotWithAnInvalidDirectionThrowsAnException ()
 {
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         var robot = new Robot("Bob", new Point(0, 0), 'Z');
     });
 }
 public void AddingARobot5NeedsInitialDirection ()
 {
     var robot = new Robot("Bob", new Point(0, 0), 'N');
     Assert.Equal('N', robot.Direction);
 }
 public void AddingARobotNeedsInitialCoordinates ()
 {
     var robot = new Robot("Bob", new Point(1, 2), 'N');
     Assert.Equal(1, robot.Position.X);
     Assert.Equal(2, robot.Position.Y);
 }
Esempio n. 8
0
 public BenderGame()
 {
     Bender = new Robot();
     TeleTransporters = new List<Point>();
 }