Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }