예제 #1
0
        public void Should_Not_Allow_Robot_To_Be_Deployed_If_BattleArena_Is_Not_Created()
        {
            _currentGame.BattleArena = null;
            var robot = new RobotFactory().Create(5, 5, StringConstants.East);

            Assert.Throws<InvalidOperationException>(() => _currentGame.Deploy(robot));
            Assert.IsNull(_currentGame.BattleArena);
        }
예제 #2
0
        public void Shoud_Not_Allow_Robot_To_Be_Deployed_Outside_Of_BattleArena()
        {
            var robot = new RobotFactory().Create(10, 10, StringConstants.East);

            Assert.Throws<InvalidOperationException>(() => _currentGame.Deploy(robot));
            Assert.IsNotNull(_currentGame.Robots);
            Assert.AreEqual(0, _currentGame.Robots.Count);
        }
예제 #3
0
 protected Robot CreateRobot(int x, int y, string direction)
 {
     var robot = new RobotFactory().Create(x, y, direction);
     robot.BattleArena = _currentGame.BattleArena;
     return robot;
 }
예제 #4
0
 public void Should_Not_Validate_Robot_Position_If_YCoordinate_Is_Greater_Than_BattleArena_Height()
 {
     var robot = new RobotFactory().Create(2, 10, StringConstants.East);
     Assert.Throws<InvalidOperationException>(() => _currentGame.ValidateRobotPosition(robot));
 }