public void ShouldStopWhenEvaluationSucceeds() { // ARRANGE var game = new Game( CardBuilder.Ace().Hearths(), CardBuilder.King().Hearths(), CardBuilder.Queen().Hearths(), CardBuilder.Jack().Hearths(), CardBuilder.Ten().Hearths()); var evaluationMock = new EvaluationMock(); evaluationMock.EvaluateReturns(new SuccessGameEvaluationResult(GameCategory.ROYAL_FLUSH, game.Cards)); var subject = new GameEvaluationChain(new IGameEvaluation[] { new WrongEvaluation(), new RightEvaluation(), evaluationMock }); // ACT subject.Evaluate(game); // ASSERT Assert.IsFalse(evaluationMock.EvaluateWasCalled); }
private Game FourAcesAndANine() { return(new Game( CardBuilder.Ace().Hearths(), CardBuilder.Ace().Diamonds(), CardBuilder.Ace().Clubs(), CardBuilder.Ace().Spades(), CardBuilder.Nine().Hearths())); }
public static Game HearthsFlush() { return(new Game( CardBuilder.Three().Hearths(), CardBuilder.Ace().Hearths(), CardBuilder.Four().Hearths(), CardBuilder.Ten().Hearths(), CardBuilder.Queen().Hearths())); }
private Game AcesFullOfKingsGame() { return(new Game( CardBuilder.Ace().Hearths(), CardBuilder.Ace().Diamonds(), CardBuilder.King().Clubs(), CardBuilder.Ace().Spades(), CardBuilder.King().Hearths())); }
public static Game HearthsRoyalFlush() { return(new Game( CardBuilder.Ace().Hearths(), CardBuilder.King().Hearths(), CardBuilder.Queen().Hearths(), CardBuilder.Jack().Hearths(), CardBuilder.Ten().Hearths())); }
public void Flush() { // ARRANGE var game = new Game( CardBuilder.Five().Spades(), CardBuilder.Six().Spades(), CardBuilder.Ace().Spades(), CardBuilder.Ten().Spades(), CardBuilder.Queen().Spades()); // ACT new GameEvaluator().Evaluate(game); // ASSERT Assert.AreEqual(GameCategory.FLUSH, game.Category); }
public void RoyalFlush() { // ARRANGE var game = new Game( CardBuilder.Ace().Hearths(), CardBuilder.King().Hearths(), CardBuilder.Queen().Hearths(), CardBuilder.Jack().Hearths(), CardBuilder.Ten().Hearths()); // ACT new GameEvaluator().Evaluate(game); // ASSERT Assert.AreEqual(GameCategory.ROYAL_FLUSH, game.Category); }
public void WrapAround() { // ARRANGE var game = new Game( CardBuilder.King().Hearths(), CardBuilder.Ace().Hearths(), CardBuilder.Two().Hearths(), CardBuilder.Three().Hearths(), CardBuilder.Four().Hearths()); // ACT var result = new StraightFlush().Evaluate(game); // ASSERT Assert.IsFalse(result.Success()); }
public void ShouldReturnTrueWhenEvaluationSucceeds() { //ARRANGE var game = new Game( CardBuilder.Ace().Hearths(), CardBuilder.King().Hearths(), CardBuilder.Queen().Hearths(), CardBuilder.Jack().Hearths(), CardBuilder.Ten().Hearths()); var evaluation = new EvaluationMock(); evaluation.EvaluateReturns(new SuccessGameEvaluationResult(GameCategory.ROYAL_FLUSH, game.Cards)); var subject = new GameEvaluationCommand(evaluation); //ACT var actual = subject.Evaluate(game); //ASSERT Assert.IsTrue(actual); }
public void ShouldReturnFalseWhenEvaluationFails() { //ARRANGE var game = new Game( CardBuilder.Ace().Hearths(), CardBuilder.King().Hearths(), CardBuilder.Queen().Hearths(), CardBuilder.Jack().Hearths(), CardBuilder.Ten().Hearths()); var evaluation = new EvaluationMock(); evaluation.EvaluateReturns(new FailedGameEvaluationResult()); var subject = new GameEvaluationCommand(evaluation); //ACT var actual = subject.Evaluate(game); //ASSERT Assert.IsFalse(actual); }