diff --git a/src/System.Device.Gpio.Tests/GpioControllerTestBase.cs b/src/System.Device.Gpio.Tests/GpioControllerTestBase.cs index 8eb9e887c7cbf77fbff0674383b7f8a09867bca1..1645b8b12e0490bdb5336b74f3c14101c6140e84 100644 --- a/src/System.Device.Gpio.Tests/GpioControllerTestBase.cs +++ b/src/System.Device.Gpio.Tests/GpioControllerTestBase.cs @@ -85,12 +85,34 @@ namespace System.Device.Gpio.Tests } [Fact] - public void IsPinOpenTest() + public void IsPinOpenOnInputTest() { using (GpioController controller = new GpioController(GetTestNumberingScheme(), GetTestDriver())) { + // Open pin in input mode (default) Assert.False(controller.IsPinOpen(LedPin)); - controller.OpenPin(LedPin); + controller.OpenPin(LedPin, PinMode.Input); + Assert.True(controller.IsPinOpen(LedPin)); + controller.ClosePin(LedPin); + Assert.False(controller.IsPinOpen(LedPin)); + } + } + + [Fact] + public void IsPinOpenOnOutputTest() + { + // Separate test to check the IsPinOpen works also when the PinMode is Output, See Bug #776 + using (GpioController controller = new GpioController(GetTestNumberingScheme(), GetTestDriver())) + { + Assert.False(controller.IsPinOpen(LedPin)); + + controller.OpenPin(LedPin, PinMode.Output); + Assert.True(controller.IsPinOpen(LedPin)); + + controller.Write(LedPin, PinValue.High); + Assert.True(controller.IsPinOpen(LedPin)); + + controller.Write(LedPin, PinValue.Low); Assert.True(controller.IsPinOpen(LedPin)); controller.ClosePin(LedPin); Assert.False(controller.IsPinOpen(LedPin));