Пример #1
0
        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);
        }
Пример #2
0
 internal void Estimate(Estimation estimation)
 {
     this.estimationsByPlayer.Add(estimation.Player, estimation);
 }
Пример #3
0
 internal bool TryGetEstimation(string player, out Estimation estimation)
 {
     return(this.estimationsByPlayer.TryGetValue(player, out estimation));
 }