Source

RockPaperScissors / RockPaperScissors / SingleRoundStrategy.cs

Diff from to

File RockPaperScissors/SingleRoundStrategy.cs

   {
     public bool ShouldPlayAgain( List<Player> gameResults )
     {
-      if ( gameResults == null ) return true;
-      else if ( gameResults.Count != 1 ) return true;
-      else return false;
+      return FindFirstWinner( gameResults ) == Player.Draw;
     }
 
     public Player GetWhoWon( List<Player> gameResults )
     {
-      if ( gameResults == null || gameResults.Count == 0 )
-        throw new InvalidOperationException( "Must have gameResults" );
+      return FindFirstWinner( gameResults );
+    }
 
-      return gameResults[0];
+    Player FindFirstWinner( List<Player> gameResults )
+    {
+      if ( gameResults == null || gameResults.Count == 0 ) return Player.Draw;
+
+      foreach ( Player p in gameResults ) // find first winner
+        if ( p != Player.Draw ) return p;
+
+      return Player.Draw;
     }
   }
 }