@@ -4,10 +4,7 @@ public sealed class EventSimulatorTests
44{
55 private const int NanosecondsPerTick = 100 ;
66
7- public EventSimulatorTests ( ) =>
8- Arb . Register < Generators > ( ) ;
9-
10- [ Property ( DisplayName = "EventSimulator should simulate key presses" ) ]
7+ [ Property ( DisplayName = "EventSimulator should simulate key presses" , Arbitrary = [ typeof ( Generators ) ] ) ]
118 public void SimulateKeyPress ( KeyCode keyCode )
129 {
1310 // Arrange
@@ -29,7 +26,9 @@ public void SimulateKeyPress(KeyCode keyCode)
2926 Assert . Equal ( keyCode , postedEvent . Keyboard . KeyCode ) ;
3027 }
3128
32- [ Property ( DisplayName = "EventSimulator should return an error if simulating a key press fails" ) ]
29+ [ Property (
30+ DisplayName = "EventSimulator should return an error if simulating a key press fails" ,
31+ Arbitrary = [ typeof ( Generators ) ] ) ]
3332 public void SimulateKeyPressFail ( KeyCode keyCode , FailedUioHookResult result )
3433 {
3534 // Arrange
@@ -50,7 +49,7 @@ public void SimulateKeyPressFail(KeyCode keyCode, FailedUioHookResult result)
5049 Assert . Equal ( result . Value , actualResult ) ;
5150 }
5251
53- [ Property ( DisplayName = "EventSimulator should simulate key releases" ) ]
52+ [ Property ( DisplayName = "EventSimulator should simulate key releases" , Arbitrary = [ typeof ( Generators ) ] ) ]
5453 public void SimulateKeyRelease ( KeyCode keyCode )
5554 {
5655 // Arrange
@@ -72,7 +71,9 @@ public void SimulateKeyRelease(KeyCode keyCode)
7271 Assert . Equal ( keyCode , postedEvent . Keyboard . KeyCode ) ;
7372 }
7473
75- [ Property ( DisplayName = "EventSimulator should return an error if simulating a key release fails" ) ]
74+ [ Property (
75+ DisplayName = "EventSimulator should return an error if simulating a key release fails" ,
76+ Arbitrary = [ typeof ( Generators ) ] ) ]
7677 public void SimulateKeyReleaseFail ( KeyCode keyCode , FailedUioHookResult result )
7778 {
7879 // Arrange
@@ -93,7 +94,7 @@ public void SimulateKeyReleaseFail(KeyCode keyCode, FailedUioHookResult result)
9394 Assert . Equal ( result . Value , actualResult ) ;
9495 }
9596
96- [ Property ( DisplayName = "EventSimulator should simulate mouse presses" ) ]
97+ [ Property ( DisplayName = "EventSimulator should simulate mouse presses" , Arbitrary = [ typeof ( Generators ) ] ) ]
9798 public void SimulateMousePress ( MouseButton button )
9899 {
99100 // Arrange
@@ -115,7 +116,9 @@ public void SimulateMousePress(MouseButton button)
115116 Assert . Equal ( button , postedEvent . Mouse . Button ) ;
116117 }
117118
118- [ Property ( DisplayName = "EventSimulator should return an error if simulating a mouse press fails" ) ]
119+ [ Property (
120+ DisplayName = "EventSimulator should return an error if simulating a mouse press fails" ,
121+ Arbitrary = [ typeof ( Generators ) ] ) ]
119122 public void SimulateMousePressFail ( MouseButton button , FailedUioHookResult result )
120123 {
121124 // Arrange
@@ -136,7 +139,9 @@ public void SimulateMousePressFail(MouseButton button, FailedUioHookResult resul
136139 Assert . Equal ( result . Value , actualResult ) ;
137140 }
138141
139- [ Property ( DisplayName = "EventSimulator should simulate mouse presses with explicit clicks" ) ]
142+ [ Property (
143+ DisplayName = "EventSimulator should simulate mouse presses with explicit clicks" ,
144+ Arbitrary = [ typeof ( Generators ) ] ) ]
140145 public void SimulateMousePressExplicitClicks ( MouseButton button , ushort clicks )
141146 {
142147 // Arrange
@@ -160,7 +165,8 @@ public void SimulateMousePressExplicitClicks(MouseButton button, ushort clicks)
160165 }
161166
162167 [ Property ( DisplayName =
163- "EventSimulator should return an error if simulating a mouse press with explicit clicks fails" ) ]
168+ "EventSimulator should return an error if simulating a mouse press with explicit clicks fails" ,
169+ Arbitrary = [ typeof ( Generators ) ] ) ]
164170 public void SimulateMousePressExplicitClicksFail ( MouseButton button , ushort clicks , FailedUioHookResult result )
165171 {
166172 // Arrange
@@ -181,7 +187,9 @@ public void SimulateMousePressExplicitClicksFail(MouseButton button, ushort clic
181187 Assert . Equal ( result . Value , actualResult ) ;
182188 }
183189
184- [ Property ( DisplayName = "EventSimulator should simulate mouse presses with explicit coordinates" ) ]
190+ [ Property (
191+ DisplayName = "EventSimulator should simulate mouse presses with explicit coordinates" ,
192+ Arbitrary = [ typeof ( Generators ) ] ) ]
185193 public void SimulateMousePressExplicitCoordinates ( short x , short y , MouseButton button )
186194 {
187195 // Arrange
@@ -206,7 +214,8 @@ public void SimulateMousePressExplicitCoordinates(short x, short y, MouseButton
206214 }
207215
208216 [ Property ( DisplayName =
209- "EventSimulator should return an error if simulating a mouse press with explicit coordinates fails" ) ]
217+ "EventSimulator should return an error if simulating a mouse press with explicit coordinates fails" ,
218+ Arbitrary = [ typeof ( Generators ) ] ) ]
210219 public void SimulateMousePressExplicitCoordinatesFail (
211220 short x ,
212221 short y ,
@@ -231,7 +240,9 @@ public void SimulateMousePressExplicitCoordinatesFail(
231240 Assert . Equal ( result . Value , actualResult ) ;
232241 }
233242
234- [ Property ( DisplayName = "EventSimulator should simulate mouse presses with explicit coordinates and clicks" ) ]
243+ [ Property (
244+ DisplayName = "EventSimulator should simulate mouse presses with explicit coordinates and clicks" ,
245+ Arbitrary = [ typeof ( Generators ) ] ) ]
235246 public void SimulateMousePressExplicitCoordinatesAndClicks ( short x , short y , MouseButton button , ushort clicks )
236247 {
237248 // Arrange
@@ -256,8 +267,10 @@ public void SimulateMousePressExplicitCoordinatesAndClicks(short x, short y, Mou
256267 Assert . Equal ( clicks , postedEvent . Mouse . Clicks ) ;
257268 }
258269
259- [ Property ( DisplayName =
260- "EventSimulator should return an error if simulating a mouse press with explicit coordinates and clicks fails" ) ]
270+ [ Property (
271+ DisplayName = "EventSimulator should return an error if simulating " +
272+ "a mouse press with explicit coordinates and clicks fails" ,
273+ Arbitrary = [ typeof ( Generators ) ] ) ]
261274 public void SimulateMousePressExplicitCoordinatesAndClicksFail (
262275 short x ,
263276 short y ,
@@ -283,7 +296,7 @@ public void SimulateMousePressExplicitCoordinatesAndClicksFail(
283296 Assert . Equal ( result . Value , actualResult ) ;
284297 }
285298
286- [ Property ( DisplayName = "EventSimulator should simulate mouse releases" ) ]
299+ [ Property ( DisplayName = "EventSimulator should simulate mouse releases" , Arbitrary = [ typeof ( Generators ) ] ) ]
287300 public void SimulateMouseRelease ( MouseButton button )
288301 {
289302 // Arrange
@@ -305,7 +318,9 @@ public void SimulateMouseRelease(MouseButton button)
305318 Assert . Equal ( button , postedEvent . Mouse . Button ) ;
306319 }
307320
308- [ Property ( DisplayName = "EventSimulator should return an error if simulating a mouse release fails" ) ]
321+ [ Property (
322+ DisplayName = "EventSimulator should return an error if simulating a mouse release fails" ,
323+ Arbitrary = [ typeof ( Generators ) ] ) ]
309324 public void SimulateMouseReleaseFail ( MouseButton button , FailedUioHookResult result )
310325 {
311326 // Arrange
@@ -326,7 +341,9 @@ public void SimulateMouseReleaseFail(MouseButton button, FailedUioHookResult res
326341 Assert . Equal ( result . Value , actualResult ) ;
327342 }
328343
329- [ Property ( DisplayName = "EventSimulator should simulate mouse releases with explicit clicks" ) ]
344+ [ Property (
345+ DisplayName = "EventSimulator should simulate mouse releases with explicit clicks" ,
346+ Arbitrary = [ typeof ( Generators ) ] ) ]
330347 public void SimulateMouseReleaseExplicitClicks ( MouseButton button , ushort clicks )
331348 {
332349 // Arrange
@@ -349,8 +366,9 @@ public void SimulateMouseReleaseExplicitClicks(MouseButton button, ushort clicks
349366 Assert . Equal ( clicks , postedEvent . Mouse . Clicks ) ;
350367 }
351368
352- [ Property ( DisplayName =
353- "EventSimulator should return an error if simulating a mouse press with explicit clicks fails" ) ]
369+ [ Property (
370+ DisplayName = "EventSimulator should return an error if simulating a mouse press with explicit clicks fails" ,
371+ Arbitrary = [ typeof ( Generators ) ] ) ]
354372 public void SimulateMouseReleaseExplicitClicksFail ( MouseButton button , ushort clicks , FailedUioHookResult result )
355373 {
356374 // Arrange
@@ -371,7 +389,9 @@ public void SimulateMouseReleaseExplicitClicksFail(MouseButton button, ushort cl
371389 Assert . Equal ( result . Value , actualResult ) ;
372390 }
373391
374- [ Property ( DisplayName = "EventSimulator should simulate mouse releases with explicit coordinates" ) ]
392+ [ Property (
393+ DisplayName = "EventSimulator should simulate mouse releases with explicit coordinates" ,
394+ Arbitrary = [ typeof ( Generators ) ] ) ]
375395 public void SimulateMouseReleaseExplicitCoordinates ( short x , short y , MouseButton button )
376396 {
377397 // Arrange
@@ -395,8 +415,10 @@ public void SimulateMouseReleaseExplicitCoordinates(short x, short y, MouseButto
395415 Assert . Equal ( button , postedEvent . Mouse . Button ) ;
396416 }
397417
398- [ Property ( DisplayName =
399- "EventSimulator should return an error if simulating a mouse release with explicit coordinates fails" ) ]
418+ [ Property (
419+ DisplayName = "EventSimulator should return an error if simulating " +
420+ "a mouse release with explicit coordinates fails" ,
421+ Arbitrary = [ typeof ( Generators ) ] ) ]
400422 public void SimulateMouseReleaseExplicitCoordinatesFail (
401423 short x ,
402424 short y ,
@@ -421,7 +443,9 @@ public void SimulateMouseReleaseExplicitCoordinatesFail(
421443 Assert . Equal ( result . Value , actualResult ) ;
422444 }
423445
424- [ Property ( DisplayName = "EventSimulator should simulate mouse releases with explicit coordinates and clicks" ) ]
446+ [ Property (
447+ DisplayName = "EventSimulator should simulate mouse releases with explicit coordinates and clicks" ,
448+ Arbitrary = [ typeof ( Generators ) ] ) ]
425449 public void SimulateMouseReleaseExplicitCoordinatesAndClicks ( short x , short y , MouseButton button , ushort clicks )
426450 {
427451 // Arrange
@@ -446,9 +470,10 @@ public void SimulateMouseReleaseExplicitCoordinatesAndClicks(short x, short y, M
446470 Assert . Equal ( clicks , postedEvent . Mouse . Clicks ) ;
447471 }
448472
449- [ Property ( DisplayName =
450- "EventSimulator should return an error " +
451- "if simulating a mouse release with explicit coordinates and clicks fails" ) ]
473+ [ Property (
474+ DisplayName = "EventSimulator should return an error if simulating " +
475+ "a mouse release with explicit coordinates and clicks fails" ,
476+ Arbitrary = [ typeof ( Generators ) ] ) ]
452477 public void SimulateMouseReleaseExplicitCoordinatesAndClicksFail (
453478 short x ,
454479 short y ,
@@ -474,7 +499,7 @@ public void SimulateMouseReleaseExplicitCoordinatesAndClicksFail(
474499 Assert . Equal ( result . Value , actualResult ) ;
475500 }
476501
477- [ Property ( DisplayName = "EventSimulator should simulate mouse movement" ) ]
502+ [ Property ( DisplayName = "EventSimulator should simulate mouse movement" , Arbitrary = [ typeof ( Generators ) ] ) ]
478503 public void SimulateMouseMovement ( short x , short y )
479504 {
480505 // Arrange
@@ -497,7 +522,9 @@ public void SimulateMouseMovement(short x, short y)
497522 Assert . Equal ( y , postedEvent . Mouse . Y ) ;
498523 }
499524
500- [ Property ( DisplayName = "EventSimulator should return an error if simulating mouse movement fails" ) ]
525+ [ Property (
526+ DisplayName = "EventSimulator should return an error if simulating mouse movement fails" ,
527+ Arbitrary = [ typeof ( Generators ) ] ) ]
501528 public void SimulateMouseMovementFail ( short x , short y , FailedUioHookResult result )
502529 {
503530 // Arrange
@@ -518,7 +545,7 @@ public void SimulateMouseMovementFail(short x, short y, FailedUioHookResult resu
518545 Assert . Equal ( result . Value , actualResult ) ;
519546 }
520547
521- [ Property ( DisplayName = "EventSimulator should simulate relative mouse movement" ) ]
548+ [ Property ( DisplayName = "EventSimulator should simulate relative mouse movement" , Arbitrary = [ typeof ( Generators ) ] ) ]
522549 public void SimulateMouseMovementRelative ( short x , short y )
523550 {
524551 // Arrange
@@ -541,7 +568,9 @@ public void SimulateMouseMovementRelative(short x, short y)
541568 Assert . Equal ( y , postedEvent . Mouse . Y ) ;
542569 }
543570
544- [ Property ( DisplayName = "EventSimulator should return an error if simulating relative mouse movement fails" ) ]
571+ [ Property (
572+ DisplayName = "EventSimulator should return an error if simulating relative mouse movement fails" ,
573+ Arbitrary = [ typeof ( Generators ) ] ) ]
545574 public void SimulateMouseMovementRelativeFail ( short x , short y , FailedUioHookResult result )
546575 {
547576 // Arrange
@@ -562,7 +591,7 @@ public void SimulateMouseMovementRelativeFail(short x, short y, FailedUioHookRes
562591 Assert . Equal ( result . Value , actualResult ) ;
563592 }
564593
565- [ Property ( DisplayName = "EventSimulator should simulate mouse wheel" ) ]
594+ [ Property ( DisplayName = "EventSimulator should simulate mouse wheel" , Arbitrary = [ typeof ( Generators ) ] ) ]
566595 public void SimulateMouseWheel (
567596 short rotation ,
568597 MouseWheelScrollDirection direction ,
@@ -589,7 +618,9 @@ public void SimulateMouseWheel(
589618 Assert . Equal ( type , postedEvent . Wheel . Type ) ;
590619 }
591620
592- [ Property ( DisplayName = "EventSimulator should return an error if simulating mouse wheel fails" ) ]
621+ [ Property (
622+ DisplayName = "EventSimulator should return an error if simulating mouse wheel fails" ,
623+ Arbitrary = [ typeof ( Generators ) ] ) ]
593624 public void SimulateMouseWheelFail (
594625 short rotation ,
595626 MouseWheelScrollDirection direction ,
@@ -614,7 +645,7 @@ public void SimulateMouseWheelFail(
614645 Assert . Equal ( result . Value , actualResult ) ;
615646 }
616647
617- [ Property ( DisplayName = "EventSimulator should simulate text entry" ) ]
648+ [ Property ( DisplayName = "EventSimulator should simulate text entry" , Arbitrary = [ typeof ( Generators ) ] ) ]
618649 public void SimulateTextEntry ( NonNull < string > text )
619650 {
620651 // Arrange
@@ -633,7 +664,9 @@ public void SimulateTextEntry(NonNull<string> text)
633664 Assert . Equal ( text . Get , provider . PostedText [ 0 ] ) ;
634665 }
635666
636- [ Property ( DisplayName = "EventSimulator should return an error if simulating text entry fails" ) ]
667+ [ Property (
668+ DisplayName = "EventSimulator should return an error if simulating text entry fails" ,
669+ Arbitrary = [ typeof ( Generators ) ] ) ]
637670 public void SimulateTextEntryFail ( NonNull < string > text , FailedUioHookResult result )
638671 {
639672 // Arrange
@@ -667,7 +700,9 @@ public void SimulateTextEntryNull()
667700 Assert . Throws < ArgumentNullException > ( ( ) => simulator . SimulateTextEntry ( null ! ) ) ;
668701 }
669702
670- [ Property ( DisplayName = "EventSimulator should return a correct text simulation delay on X11" ) ]
703+ [ Property (
704+ DisplayName = "EventSimulator should return a correct text simulation delay on X11" ,
705+ Arbitrary = [ typeof ( Generators ) ] ) ]
671706 public void GetTextSimulationDelayOnX11 ( ulong delay )
672707 {
673708 // Arrange
@@ -686,7 +721,9 @@ public void GetTextSimulationDelayOnX11(ulong delay)
686721 ( ulong ) ( simulator . TextSimulationDelayOnX11 . Ticks * NanosecondsPerTick ) ) ;
687722 }
688723
689- [ Property ( DisplayName = "EventSimulator should set a correct text simulation delay on X11 or throw an exception" ) ]
724+ [ Property (
725+ DisplayName = "EventSimulator should set a correct text simulation delay on X11 or throw an exception" ,
726+ Arbitrary = [ typeof ( Generators ) ] ) ]
690727 public void SetTextSimulationDelayOnX11 ( TimeSpan timeSpan )
691728 {
692729 // Arrange
0 commit comments