public HandsPlayResultOptions.Result ResolveHandsPlayWithStrategies(HandsPlay handsPlay) { foreach (var strategy in _listOfHandPlayStrategies.Where(strategy => strategy.Key.Equals(handsPlay))) { return(strategy.Value); } return(HandsPlayResultOptions.Result.Draw); }
private GameTurn ResolveTurnOfHandsPlayFromPlayersUsing(HandsPlay handsPlayExecuted) { var gameTurn = new GameTurn { HandsPlayOfTheTurn = handsPlayExecuted, ResultOfTheHandsPlay = _handsPlayResolverService.ResolveHandsPlayWithStrategies(handsPlayExecuted) }; return(gameTurn); }
public void Test_that_the_overriden_equals_function_works_as_expected() { // Act var handsPlay1 = new HandsPlay(HandMovementOptions.HandMovement.Paper, HandMovementOptions.HandMovement.Rock); var handsPlay2 = new HandsPlay(HandMovementOptions.HandMovement.Paper, HandMovementOptions.HandMovement.Rock); var handsPlay3 = new HandsPlay(HandMovementOptions.HandMovement.Scissors, HandMovementOptions.HandMovement.Scissors); // Assert Assert.That(handsPlay1.Equals(handsPlay2), Is.True); Assert.That(handsPlay2.Equals(handsPlay3), Is.False); }