Source

RockPaperScissors / RockPaperScissors / SingleRoundStrategy.cs

Full commit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RockPaperScissors
{
  public class SingleRoundStrategy : IShouldPlayAgain, IKnowWhoWon
  {
    public bool ShouldPlayAgain( List<Winner> gameResults )
    {
      return FindFirstWinner( gameResults ) == Winner.Draw;
    }

    public Winner GetWhoWon( List<Winner> gameResults )
    {
      return FindFirstWinner( gameResults );
    }

    Winner FindFirstWinner( List<Winner> gameResults )
    {
      if ( gameResults == null || gameResults.Count == 0 ) return Winner.Draw;

      foreach ( Winner p in gameResults ) // find first winner
        if ( p != Winner.Draw ) return p;

      return Winner.Draw;
    }
  }
}