提交 523aa57b 编写于 作者: P Patrick Grawehr 提交者: Krzysztof Wicher

Test for Bug #776 (#806)

* Test for Bug #776

The problem does not show up for me, though.

* Improve test names

* Explicitly state pin as input, so test situation is clear
上级 a3f0feb0
......@@ -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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册