File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11namespace TJC . StateMachine . Tests . Mocks
22{
3- internal class RevolverMock ( )
4- : StateMachineBase < RevolverStates > ( RevolverStates . Loaded )
3+ internal class RevolverMock ( ) : StateMachineBase < RevolverStates > ( RevolverStates . Loaded )
54 {
65 public int BulletsLoaded { get ; private set ; } = 6 ;
76
@@ -17,7 +16,9 @@ public bool TryShoot()
1716 State = RevolverStates . Empty ;
1817 return true ;
1918 default :
20- throw new InvalidOperationException ( $ "Unknown State [{ State } ] for method { nameof ( TryShoot ) } ") ;
19+ throw new InvalidOperationException (
20+ $ "Unknown State [{ State } ] for method { nameof ( TryShoot ) } "
21+ ) ;
2122 }
2223 }
2324
@@ -27,4 +28,4 @@ public void Reload()
2728 State = RevolverStates . Loaded ;
2829 }
2930 }
30- }
31+ }
Original file line number Diff line number Diff line change 33 internal enum RevolverStates
44 {
55 Loaded ,
6- Empty
6+ Empty ,
77 }
8- }
8+ }
Original file line number Diff line number Diff line change @@ -9,18 +9,24 @@ public class StatePropertyAccessibility
99 [ TestMethod ]
1010 public void EnsurePropertyStateIsNotPubliclyAccessible ( )
1111 {
12- var prop = typeof ( StateMachineBase < RevolverStates > ) . GetProperty ( "State" , BindingFlags . Instance | BindingFlags . Public ) ;
12+ var prop = typeof ( StateMachineBase < RevolverStates > ) . GetProperty (
13+ "State" ,
14+ BindingFlags . Instance | BindingFlags . Public
15+ ) ;
1316 Assert . IsNull ( prop ) ;
1417 }
1518
1619 [ TestMethod ]
1720 public void EnsurePropertyStateIsProtectedAccessible ( )
1821 {
19- var prop = typeof ( StateMachineBase < RevolverStates > ) . GetProperty ( "State" , BindingFlags . Instance | BindingFlags . NonPublic ) ;
22+ var prop = typeof ( StateMachineBase < RevolverStates > ) . GetProperty (
23+ "State" ,
24+ BindingFlags . Instance | BindingFlags . NonPublic
25+ ) ;
2026 Assert . IsNotNull ( prop ) ;
2127 var getter = prop . GetMethod ;
2228 Assert . IsNotNull ( getter ) ;
2329 Assert . IsTrue ( getter . IsFamily ) ;
2430 }
2531 }
26- }
32+ }
Original file line number Diff line number Diff line change @@ -12,4 +12,4 @@ public class StateMachineBase<T>(T initialState)
1212 /// </summary>
1313 protected T State { get ; set ; } = initialState ;
1414 }
15- }
15+ }
You can’t perform that action at this time.
0 commit comments