public void ShouldHaveValidationErrorForInvalidRoundsWhenCalculatingTwelveRounds( int firstRollForRoundTen, int secondRollForRoundTen, int firstRollForRoundEleven, int secondRollForRoundEleven) { var calculateRoundScores = new CalculateRoundScores { Rounds = Enumerable.Repeat(new RoundRolls { FirstRoll = 10, SecondRoll = 0 }, 10) }; calculateRoundScores.Rounds = calculateRoundScores.Rounds.Concat(new[] { new RoundRolls { FirstRoll = firstRollForRoundTen, SecondRoll = secondRollForRoundTen }, new RoundRolls { FirstRoll = firstRollForRoundEleven, SecondRoll = secondRollForRoundEleven } }); _validator.ShouldHaveValidationErrorFor(scores => scores.Rounds.ToList(), calculateRoundScores); }
public void ShouldHaveNotValidationErrorForValidRoundsWhenCalculatingElevenRounds(int firstRollForTenthRound, int secondRollForTenthRound) { var calculateRoundScores = new CalculateRoundScores { Rounds = Enumerable.Repeat(new RoundRolls { FirstRoll = 10, SecondRoll = 0 }, 9) }; calculateRoundScores.Rounds = calculateRoundScores.Rounds.Concat(new[] { new RoundRolls { FirstRoll = firstRollForTenthRound, SecondRoll = secondRollForTenthRound }, new RoundRolls { FirstRoll = 5, SecondRoll = 5 } }); _validator.ShouldHaveValidationErrorFor(scores => scores.Rounds.ToList(), calculateRoundScores); }
public void ShouldHaveValidationErrorForOutOfRangeRollValueSums() { var calculateRoundScores = new CalculateRoundScores { Rounds = Enumerable.Repeat(new RoundRolls { FirstRoll = 10, SecondRoll = 10 }, 2) }; _validator.ShouldHaveValidationErrorFor(scores => scores.Rounds, calculateRoundScores); }
public void ShouldNotHaveValidationErrorForValidRollValues(int firstRoll, int secondRoll) { var calculateRoundScores = new CalculateRoundScores { Rounds = Enumerable.Repeat(new RoundRolls { FirstRoll = firstRoll, SecondRoll = secondRoll }, 2) }; _validator.ShouldNotHaveValidationErrorFor(scores => scores.Rounds, calculateRoundScores); }
public void ShouldNotHaveValidationErrorForValidRoundsCount(int roundsCount) { var calculateRoundScores = new CalculateRoundScores { Rounds = Enumerable.Repeat(new RoundRolls { FirstRoll = 10, SecondRoll = 0 }, roundsCount) }; _validator.ShouldNotHaveValidationErrorFor(scores => scores.Rounds.Count(), calculateRoundScores); }
public ActionResult <IEnumerable <RoundScore> > Calculate([FromBody] CalculateRoundScores calculateRoundScores) { return(Ok(_handler.Handle(calculateRoundScores))); }