public IGameOperationResult Estimate(Estimation estimation) { var currentRound = this.rounds.LastOrDefault(); if (currentRound == null) { return(new Failure <string>("Cannot estimate without first starting a round")); } if (currentRound.FinishedAt.HasValue) { return(new Failure <string>($"The round regarding {currentRound.Subject} is over")); } if (currentRound.TryGetEstimation(estimation.Player, out _)) { return(new Failure <string>($"{estimation.Player} has already estimated in this round")); } currentRound.Estimate(estimation); return(Success.Instance); }
internal void Estimate(Estimation estimation) { this.estimationsByPlayer.Add(estimation.Player, estimation); }
internal bool TryGetEstimation(string player, out Estimation estimation) { return(this.estimationsByPlayer.TryGetValue(player, out estimation)); }