public void HighestPriorityIndicesForId() { var priorities = new [] { MarsEntityPriority.Normal, MarsEntityPriority.High, MarsEntityPriority.Low, MarsEntityPriority.Normal, MarsEntityPriority.High, MarsEntityPriority.Low, // these 2 won't be included in the set of indices we're searching, so shouldn't appear in the results MarsEntityPriority.High, MarsEntityPriority.Normal }; var indices1 = new HashSet <int> { 0, 1, 2, 3, 4, 5 }; var highestPriorityIndices = FindBestMatchTransform.HighestPriorityIndicesForId(indices1, priorities); Assert.AreEqual(2, highestPriorityIndices.Count); Assert.Contains(1, highestPriorityIndices); Assert.Contains(4, highestPriorityIndices); // what if we don't include the indices that are set to High priority ? var indices2 = new HashSet <int> { 0, 2, 3, 5, 7 }; highestPriorityIndices = FindBestMatchTransform.HighestPriorityIndicesForId(indices2, priorities); Assert.AreEqual(3, highestPriorityIndices.Count); Assert.Contains(0, highestPriorityIndices); Assert.Contains(3, highestPriorityIndices); Assert.Contains(7, highestPriorityIndices); }
public void FindBestStandaloneMatches_ResolveConflicts(MatchConflictTestInput input) { var ratings = input.ratings; var dataTransform = new FindBestMatchTransform(input.ratings.Length); var idRequests = dataTransform.BuildRequestMap(input.workingIndices, ratings, input.exclusivities); var assignments = dataTransform.ResolveConflicts(idRequests, ratings, input.priorities); // uncomment to debug this tests's results //assignments.DebugLogBlock(); AssertUtils.DeepEqual(input.expectedAssignments, assignments); }