public void EndGame() { ActionApplier actionApplier = GetActionApplier(out ActionApplierContext actionApplierContext, false, false, ActionApplierContext.EndGameSymbol); GameFlow flow = actionApplier.ApplyAction(new Board(), ActionApplierContext.EndGameSymbol); Assert.Equal(GameFlow.END_GAME, flow); actionApplierContext.MovementDisplayNamesResolver .Verify(mdnr => mdnr.TryResolve(Match.Create <string>(action => action == ActionApplierContext.EndGameSymbol), out movement), Times.Once); actionApplierContext.TileMover.Verify(tm => tm.TryMove(It.IsAny <Board>(), It.IsAny <Movement>(), out err), Times.Never); }
public void ActionResolved_MovementDone() { ActionApplier actionApplier = GetActionApplier(out ActionApplierContext actionApplierContext, true, true, ACTION_NAME); GameFlow flow = actionApplier.ApplyAction(new Board(), ACTION_NAME); Assert.Equal(GameFlow.KEEP_PLAYING, flow); actionApplierContext.IO.Verify(io => io.WriteLine(It.IsAny <string>(), It.IsAny <int>()), Times.Never); actionApplierContext.MovementDisplayNamesResolver .Verify(mdnr => mdnr.TryResolve(Match.Create <string>(action => action == ACTION_NAME), out movement), Times.Once); actionApplierContext.TileMover.Verify(tm => tm.TryMove(It.IsAny <Board>(), It.IsAny <Movement>(), out err), Times.Once); }
public void UnknownAction() { string unknwonAction = "SOME_UNKNOWN_ACTION"; ActionApplier actionApplier = GetActionApplier(out ActionApplierContext actionApplierContext, false, false, unknwonAction); GameFlow flow = actionApplier.ApplyAction(new Board(), unknwonAction); Assert.Equal(GameFlow.KEEP_PLAYING, flow); actionApplierContext.IO.Verify(io => io.WriteLine( Match.Create <string>(err => err.Contains(unknwonAction)), It.IsAny <int>()), Times.Once); actionApplierContext.MovementDisplayNamesResolver .Verify(mdnr => mdnr.TryResolve(Match.Create <string>(action => action == unknwonAction), out movement), Times.Once); actionApplierContext.TileMover.Verify(tm => tm.TryMove(It.IsAny <Board>(), It.IsAny <Movement>(), out err), Times.Never); }