예제 #1
0
        public async Task be_able_turn_90_degrees_anti_clockwise(char currentOrientation, char expectedOrientation)
        {
            // arrange

            IPosition setting = new DevicePosition(5, 5, currentOrientation) as IPosition;

            _initialSettingsMock.Setup(x => x.DevicePosition).Returns(setting);
            _buffer = new DeviceBuffer();
            var _device = new SLMMDevice(_initialSettingsMock.Object, _buffer, _actuator);

            // act
            var position = await _device.TurnCounterClockwise();

            // assert
            Assert.AreEqual(expectedOrientation, position.Orientation);
        }
예제 #2
0
        public async Task turns_anti_clockwise_in_around_2_seconds()
        {
            var actuator = new TestsActuator(true);

            _device = new SLMMDevice(_initialSettingsMock.Object, _buffer, actuator);

            // act
            var watch    = System.Diagnostics.Stopwatch.StartNew();
            var position = await _device.TurnCounterClockwise();

            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;

            // assert
            Assert.GreaterOrEqual(elapsedMs, 2000);
            Assert.LessOrEqual(elapsedMs, 3000);
        }
예제 #3
0
        public async Task be_able_turn_anti_clockwise_in_sequence(char start, int numberTurns, char expected)
        {
            // arrange
            IPosition setting = new DevicePosition(5, 5, start) as IPosition;

            _initialSettingsMock.Setup(x => x.DevicePosition).Returns(setting);
            _buffer = new DeviceBuffer();
            _device = new SLMMDevice(_initialSettingsMock.Object, _buffer, _actuator);

            IPosition position = _device.CurrentPosition();

            // act
            for (int i = 0; i < numberTurns; i++)
            {
                position = await _device.TurnCounterClockwise();
            }

            // assert
            Assert.AreEqual(expected, position.Orientation);
        }