public virtual bool Validate(IRacingCards racingCards) { if (_next != null) { return(_next.Validate(racingCards)); } return(true); }
public void CardsTurn(SelectedCardsConfirmationDelegate selectedCardsConfirmation) { var valid = false; var selectedCards = _userCallbacksNotifications.SelectRacingCard(MyRacingCards); valid = selectedCardsConfirmation(selectedCards) && _preConditionRaicingCards.Validate(selectedCards); while (!valid) { selectedCards = _userCallbacksNotifications.SelectRacingCard(MyRacingCards); valid = selectedCardsConfirmation(selectedCards) && _preConditionRaicingCards.Validate(selectedCards); } selectedCards.ToList().ForEach(x => MyRacingCards.Remove(x)); Enumerable.Range(0, selectedCards.Count()) .ToList() .ForEach(x => MyRacingCards.Add(_racingCardManager.TakeCard())); }