예제 #1
0
        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));
        }
예제 #2
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));
        }
예제 #3
0
 public void StartCleaning()
 {
     _robotEngine.RunEngine();
 }