public ActualResultsPool(MultipleChoicePool multipleChoicePool, IResultSet actualResults) { _multipleChoicePool = multipleChoicePool; _actualResults = actualResults; _contraryWinnerWagersTotalStakeValue = _multipleChoicePool._possibleResults .ToDictionary(_ => _, _ => 0M); _loserWagersWithoutContraryWinnerWagersTotalStakeValue = _multipleChoicePool._possibleResults .ToDictionary(_ => _, _ => 0M); _contraryLoserWagersWithExpectedResultsTotalStakeValue = _multipleChoicePool._possibleResults .ToDictionary( a => a, a => (IDictionary <IResultSet, decimal>)_multipleChoicePool._possibleResults .ToDictionary(b => b, b => 0M)); }
/// <summary> /// Creates a new instance of <see cref="MultipleChoiceBet" /> for a set of individual results. /// The <see cref="PossibleResults" /> for this bet are equal to all proper subsets of the specified /// set of individual results. /// </summary> /// <param name="availableResults">All individual results.</param> /// <exception cref="ArgumentNullException"> /// Occurs if <paramref name="availableResults" /> is <c>null</c>. /// </exception> /// <exception cref="ArgumentException"> /// Occurs if <paramref name="availableResults" /> contains duplicates or <c>null</c> values. /// </exception> public MultipleChoiceBet(IEnumerable <IResult> availableResults) { if (availableResults == null) { throw new ArgumentNullException(nameof(availableResults)); } var availableResultsList = availableResults.ToList(); if (availableResultsList.Contains(null)) { throw new ArgumentException("Specified value cannot contain null values.", nameof(availableResults)); } if (availableResultsList.Distinct().Count() != availableResultsList.Count) { throw new ArgumentException("Specified value cannot contain duplicates.", nameof(availableResults)); } PossibleResults = new ResultSet(availableResultsList).Subsets; _multipleChoicePool = new MultipleChoicePool(PossibleResults); }