public void PlayGame(Guid redOffensive, Guid redDefensive, Guid blueOffensive, Guid blueDefensive, int scoreRed, int scoreBlue) { ValidatePlayers(redOffensive, redDefensive, blueOffensive, blueDefensive); var scoreValidator = new ScoreValidator(scoreRed, scoreBlue); if (!scoreValidator.IsValid) { throw new InvalidOperationException(scoreValidator.Message); } var @event = new GamePlayed { RedOffensive = redOffensive, RedDefensive=redDefensive, BlueOffensive=blueOffensive, BlueDefensive = blueDefensive, ScoreRed = scoreRed, ScoreBlue = scoreBlue, }; Append(@event); Apply(@event); }
public void PlayGame(Guid redOffensive, Guid redDefensive, Guid blueOffensive, Guid blueDefensive, int scoreRed, int scoreBlue) { ValidatePlayers(redOffensive, redDefensive, blueOffensive, blueDefensive); var scoreValidator = new ScoreValidator(scoreRed, scoreBlue); if (!scoreValidator.IsValid) { throw new InvalidOperationException(scoreValidator.Message); } var @event = new GamePlayed { RedOffensive = redOffensive, RedDefensive = redDefensive, BlueOffensive = blueOffensive, BlueDefensive = blueDefensive, ScoreRed = scoreRed, ScoreBlue = scoreBlue, }; Append(@event); Apply(@event); }
public void ValidateScore(int scoreRed, int scoreBlue, bool expect) { var validator = new ScoreValidator(scoreRed, scoreBlue); Assert.AreEqual(expect, validator.IsValid, validator.Message); }