@@ -26,14 +26,14 @@ public void Dispose()
26
26
[ Fact ]
27
27
public void PinCountReportedCorrectly ( )
28
28
{
29
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
29
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
30
30
Assert . Equal ( 28 , ctrl . PinCount ) ;
31
31
}
32
32
33
33
[ Fact ]
34
34
public void OpenTwiceGpioPinAndClosedTwiceThrows ( )
35
35
{
36
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
36
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
37
37
_mockedGpioDriver . Setup ( x => x . OpenPinEx ( 1 ) ) ;
38
38
_mockedGpioDriver . Setup ( x => x . ClosePinEx ( 1 ) ) ;
39
39
GpioPin gpioPin1 = ctrl . OpenPin ( 1 ) ;
@@ -50,7 +50,7 @@ public void WriteInputPinDoesNotThrow()
50
50
_mockedGpioDriver . Setup ( x => x . IsPinModeSupportedEx ( 1 , It . IsAny < PinMode > ( ) ) ) . Returns ( true ) ;
51
51
_mockedGpioDriver . Setup ( x => x . SetPinModeEx ( 1 , It . IsAny < PinMode > ( ) ) ) ;
52
52
_mockedGpioDriver . Setup ( x => x . GetPinModeEx ( 1 ) ) . Returns ( PinMode . Input ) ;
53
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
53
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
54
54
55
55
ctrl . OpenPin ( 1 , PinMode . Input ) ;
56
56
ctrl . Write ( 1 , PinValue . High ) ;
@@ -64,7 +64,7 @@ public void GpioControllerCreateOpenClosePin()
64
64
_mockedGpioDriver . Setup ( x => x . GetPinModeEx ( 1 ) ) . Returns ( PinMode . Output ) ;
65
65
_mockedGpioDriver . Setup ( x => x . WriteEx ( 1 , PinValue . High ) ) ;
66
66
_mockedGpioDriver . Setup ( x => x . ClosePinEx ( 1 ) ) ;
67
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
67
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
68
68
Assert . NotNull ( ctrl ) ;
69
69
ctrl . OpenPin ( 1 , PinMode . Output ) ;
70
70
Assert . True ( ctrl . IsPinOpen ( 1 ) ) ;
@@ -77,7 +77,7 @@ public void GpioControllerCreateOpenClosePin()
77
77
public void IsPinModeSupported ( )
78
78
{
79
79
_mockedGpioDriver . Setup ( x => x . IsPinModeSupportedEx ( 1 , PinMode . Input ) ) . Returns ( true ) ;
80
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
80
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
81
81
Assert . NotNull ( ctrl ) ;
82
82
Assert . True ( ctrl . IsPinModeSupported ( 1 , PinMode . Input ) ) ;
83
83
}
@@ -87,7 +87,7 @@ public void GetPinMode()
87
87
{
88
88
_mockedGpioDriver . Setup ( x => x . OpenPinEx ( 1 ) ) ;
89
89
_mockedGpioDriver . Setup ( x => x . GetPinModeEx ( 1 ) ) . Returns ( PinMode . Output ) ;
90
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
90
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
91
91
Assert . NotNull ( ctrl ) ;
92
92
// Not open
93
93
Assert . Throws < InvalidOperationException > ( ( ) => ctrl . GetPinMode ( 1 ) ) ;
@@ -96,6 +96,7 @@ public void GetPinMode()
96
96
}
97
97
98
98
[ Fact ]
99
+ [ Obsolete ( "Tests an obsolete feature" ) ]
99
100
public void UsingBoardNumberingWorks ( )
100
101
{
101
102
// Our mock driver maps physical pin 2 to logical pin 1
@@ -122,14 +123,15 @@ public void UsingLogicalNumberingDisposesTheRightPin()
122
123
_mockedGpioDriver . Setup ( x => x . ClosePinEx ( 1 ) ) ;
123
124
_mockedGpioDriver . Setup ( x => x . IsPinModeSupportedEx ( 1 , PinMode . Output ) ) . Returns ( true ) ;
124
125
_mockedGpioDriver . Setup ( x => x . GetPinModeEx ( 1 ) ) . Returns ( PinMode . Output ) ;
125
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
126
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
126
127
ctrl . OpenPin ( 1 , PinMode . Output ) ;
127
128
ctrl . Write ( 1 , PinValue . High ) ;
128
129
// No close on the pin here, we want to check that the Controller's Dispose works correctly
129
130
ctrl . Dispose ( ) ;
130
131
}
131
132
132
133
[ Fact ]
134
+ [ Obsolete ( "Tests obsolete features" ) ]
133
135
public void UsingBoardNumberingDisposesTheRightPin ( )
134
136
{
135
137
// Our mock driver maps physical pin 2 to logical pin 1
@@ -151,7 +153,7 @@ public void CallbackOnEventWorks()
151
153
_mockedGpioDriver . Setup ( x => x . OpenPinEx ( 1 ) ) ;
152
154
_mockedGpioDriver . Setup ( x => x . AddCallbackForPinValueChangedEventEx ( 1 ,
153
155
PinEventTypes . Rising , It . IsAny < PinChangeEventHandler > ( ) ) ) ;
154
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
156
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
155
157
ctrl . OpenPin ( 1 ) ; // logical pin 1 on our test board
156
158
bool callbackSeen = false ;
157
159
PinChangeEventHandler eventHandler = ( sender , args ) =>
@@ -183,7 +185,7 @@ public void WriteSpan()
183
185
_mockedGpioDriver . Setup ( x => x . WriteEx ( 2 , PinValue . Low ) ) ;
184
186
_mockedGpioDriver . Setup ( x => x . ClosePinEx ( 1 ) ) ;
185
187
_mockedGpioDriver . Setup ( x => x . ClosePinEx ( 2 ) ) ;
186
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
188
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
187
189
Assert . NotNull ( ctrl ) ;
188
190
ctrl . OpenPin ( 1 , PinMode . Output ) ;
189
191
ctrl . OpenPin ( 2 , PinMode . Output ) ;
@@ -208,7 +210,7 @@ public void ReadSpan()
208
210
_mockedGpioDriver . Setup ( x => x . ReadEx ( 2 ) ) . Returns ( PinValue . High ) ;
209
211
_mockedGpioDriver . Setup ( x => x . ClosePinEx ( 1 ) ) ;
210
212
_mockedGpioDriver . Setup ( x => x . ClosePinEx ( 2 ) ) ;
211
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
213
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
212
214
Assert . NotNull ( ctrl ) ;
213
215
ctrl . OpenPin ( 1 , PinMode . Input ) ;
214
216
ctrl . OpenPin ( 2 , PinMode . Input ) ;
@@ -238,7 +240,7 @@ public void ReadSpan()
238
240
[ Fact ]
239
241
public async Task WaitForEventAsyncFail ( )
240
242
{
241
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
243
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
242
244
_mockedGpioDriver . Setup ( x => x . OpenPinEx ( 1 ) ) ;
243
245
_mockedGpioDriver . Setup ( x => x . IsPinModeSupportedEx ( 1 , PinMode . Input ) ) . Returns ( true ) ;
244
246
_mockedGpioDriver . Setup ( x => x . WaitForEventEx ( 1 , PinEventTypes . Rising | PinEventTypes . Falling , It . IsAny < CancellationToken > ( ) ) )
@@ -260,7 +262,7 @@ public async Task WaitForEventAsyncFail()
260
262
[ Fact ]
261
263
public void WaitForEventSuccess ( )
262
264
{
263
- var ctrl = new GpioController ( PinNumberingScheme . Logical , _mockedGpioDriver . Object ) ;
265
+ var ctrl = new GpioController ( _mockedGpioDriver . Object ) ;
264
266
_mockedGpioDriver . Setup ( x => x . OpenPinEx ( 1 ) ) ;
265
267
_mockedGpioDriver . Setup ( x => x . IsPinModeSupportedEx ( 1 , PinMode . Input ) ) . Returns ( true ) ;
266
268
_mockedGpioDriver . Setup ( x => x . WaitForEventEx ( 1 , PinEventTypes . Rising | PinEventTypes . Falling , It . IsAny < CancellationToken > ( ) ) )
0 commit comments