示例#1
0
        public async Task SetDirectionAsync_default_DirectionPropertyIsUpdated(Direction initialDirection, Direction newDirection)
        {
            // Arrange
            var fixture = new PwmControllerFixture();

            var dut =
                await fixture
                .WithDirection(initialDirection)
                .CreateDutAsync();

            // Act
            await dut.SetDirectionAsync(newDirection);

            // Assert
            dut.Direction.Should()
            .Be(newDirection);
        }
示例#2
0
        public async Task SetDirectionAsync_Running_ChangesCurrentPinDutyCycleToZeroThenSpinsUpOtherPin(
            int initialPercentDutyCycle, int expectedDutyCycle)
        {
            // Arrange
            var fixture = new PwmControllerFixture();

            var dut =
                await fixture
                .WithDirection(Direction.Forward)
                .WithDutyCyclePercent(initialPercentDutyCycle)
                .WithForwardPinDutyCycle(expectedDutyCycle)
                .CreateDutAsync();

            // Act
            await dut.SetDirectionAsync(Direction.Backward);

            // Assert
            fixture.ForwardPwmPin.CurrentDutyCyclePercent.Should().Be(0);
            fixture.BackwardPwmPin.CurrentDutyCyclePercent.Should().Be(expectedDutyCycle);
        }