public void RunEngine_ShouldCleanUniquePositions()
        {
            // Arrange
            var statingPosition = Coordinate.CreateInstance(1, 1);
            var movements       = new List <IMovement>
            {
                new Movement(Direction.East, 1),
                new Movement(Direction.North, 1),
                new Movement(Direction.West, 1),
                new Movement(Direction.South, 1),
                new Movement(Direction.East, 1),
                new Movement(Direction.North, 1),
                new Movement(Direction.West, 1),
                new Movement(Direction.South, 1),
            };

            _robotEngine = RobotEngineFactory.CreateRobotEngine(statingPosition, movements, MinCoordinate, MaxCoordinate);

            // Act
            _robotEngine.RunEngine();

            // Assert
            var actual   = _robotEngine.CleanedPositions;
            var expected = new HashSet <Coordinate>
            {
                Coordinate.CreateInstance(1, 1),
                Coordinate.CreateInstance(1, 2),
                Coordinate.CreateInstance(2, 2),
                Coordinate.CreateInstance(2, 1),
            };

            Assert.That(actual, Is.EquivalentTo(expected));
        }
Esempio n. 2
0
        public Robot(IRobotEngine engine)
        {
            if (engine == null)
            {
                throw new ArgumentNullException(nameof(engine));
            }

            _engine = engine;
        }
Esempio n. 3
0
        public Robot(IRobotEngine engine)
        {
            _engine = engine;
            InitializeState();

            try
            {
                _engine.Connect();
            }
            catch (Exception e)
            {
                Logger.Warn(string.Format("Ошибка подключения к роботу: {0}", e.Message));
                AppGlobals.Form.AbortEngineThread();
            }

            Logger.Success("Подключился к роботу");

            PositionIndex = 0;
        }
        public void RunEngine_MoveToBorders(int xCoordinate, int yCoordinate, Direction direction, int steps, int expectedX, int expectedY)
        {
            // Arrange
            var statingPosition = Coordinate.CreateInstance(xCoordinate, yCoordinate);
            var movements       = new List <IMovement>
            {
                new Movement(direction, steps),
            };

            _robotEngine = RobotEngineFactory.CreateRobotEngine(statingPosition, movements, MinCoordinate, MaxCoordinate);

            // Act
            _robotEngine.RunEngine();

            // Assert
            var actual   = _robotEngine.CleanedPositions;
            var expected = new HashSet <Coordinate>
            {
                Coordinate.CreateInstance(expectedX, expectedY)
            };

            Assert.That(actual, Is.EquivalentTo(expected));
        }
Esempio n. 5
0
 public FileTextConsumer(IRobotEngine robotEngine, IDisplayConsole displayConsole) : base(robotEngine, displayConsole)
 {
 }
 public RobotPilot(IRobotEngine robot)
 {
     this.robot = robot;
     CleanAtPosition();
 }
Esempio n. 7
0
 public Robot(IRobotEngine engine)
 {
     _engine = engine;
     _engine.Connect();
 }
Esempio n. 8
0
 protected BaseConsumer(IRobotEngine robotEngine, IDisplayConsole displayConsole)
 {
     RobotEngine    = robotEngine;
     DisplayConsole = displayConsole;
 }
Esempio n. 9
0
 public RobotPilot(IRobotEngine robot)
 {
     this.robot = robot;
     CleanAtPosition();
 }
Esempio n. 10
0
 public GameController(IPathService pathService, IRobotEngine robotEngine, IGameService gameService)
 {
     this.PathService = pathService;
     this.RobotEngine = robotEngine;
     this.GameService = gameService;
 }
 public GridRestrictedRobotEngine(IRobotEngine engine, ICleaningGrid grid)
 {
     this.engine = engine;
     this.grid = grid;
 }
Esempio n. 12
0
 public static IRobot CreateRobot(IRobotEngine robotEngine)
 {
     return(new Robot(robotEngine));
 }
Esempio n. 13
0
 public Robot(IRobotEngine engine)
 {
     _engine = engine;
     _engine.Connect();
 }
Esempio n. 14
0
 public Robot(IRobotEngine robotEngine)
 {
     _robotEngine = robotEngine;
 }
Esempio n. 15
0
 public GridRestrictedRobotEngine(IRobotEngine engine, ICleaningGrid grid)
 {
     this.engine = engine;
     this.grid   = grid;
 }