public ItemsWithConflictingHighestScoreException(ItemWithScore[] itemsWithConflictingScore, ItemWithScore[] allItems, int highestScore) : base(string.Format( "items with conflicting highest score of {0} exists, cannot determine default", highestScore)) { ItemsWithConflictingScore = itemsWithConflictingScore; AllItems = allItems; HighestScore = highestScore; }
private bool TrySelectDefault(ItemWithScore[] itemsWithCalculatedScore, out ItemEvaluation? defaultItem) { var itemsWithNoReferences = itemsWithCalculatedScore.Where(x => !x.Item.ConditionsEvaluation.Any()); if (itemsWithNoReferences.Count() != 1) { defaultItem = null; return false; } defaultItem = itemsWithNoReferences.Single().Item; return true; }