public void Handle_WhenPresent_WhenNoAbsent_RunPresentAction() { var handlePresent = new MockAction <string>(); var option = Optional <string> .Of("present"); option.Handle(value => handlePresent.Run(value)); handlePresent.VerifyActionCalled("present"); }
public void Handle_WhenNull_RunAbsentAction() { var handlePresent = new MockAction <string>(); var handleAbsent = new MockAction(); var option = Optional <string> .Of(null); option.Handle(value => handlePresent.Run(value), () => handleAbsent.Run()); handlePresent.VerifyActionNotCalled(); handleAbsent.VerifyActionCalled(); }
public void Play_VerifyActionCalled() { var action = new MockAction(); var state = PLAY(); StateTests <IGameState> .For(state) .When(() => state.Play(() => action.Run())) .Invoke(); action.VerifyActionCalled(); }
public void SwitchPlayer_VerifyActionCalled() { var action = new MockAction(); var state = SWITCH_PLAYER(); StateTests <IGameState> .For(state) .When(() => state.SwitchPlayer(() => action.Run())) .Invoke(); action.VerifyActionCalled(); }