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); }
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); }