public void SortStringWithQualityHeaderValuesByQFactor_SortsCorrectly(IEnumerable <string> unsorted, IEnumerable <string> expectedSorted) { // Arrange MockContentNegotiator negotiator = new MockContentNegotiator(); List <StringWithQualityHeaderValue> unsortedValues = new List <StringWithQualityHeaderValue>(unsorted.Select(u => StringWithQualityHeaderValue.Parse(u))); List <StringWithQualityHeaderValue> expectedSortedValues = new List <StringWithQualityHeaderValue>(expectedSorted.Select(u => StringWithQualityHeaderValue.Parse(u))); // Act IEnumerable <StringWithQualityHeaderValue> actualSorted = negotiator.SortStringWithQualityHeaderValuesByQFactor(unsortedValues); // Assert Assert.True(expectedSortedValues.SequenceEqual(actualSorted)); }
public void SortStringWithQualityHeaderValuesByQFactor_ThrowsOnNull() { MockContentNegotiator negotiator = new MockContentNegotiator(); Assert.ThrowsArgumentNull(() => negotiator.SortStringWithQualityHeaderValuesByQFactor((HttpHeaderValueCollection <StringWithQualityHeaderValue>)null), "headerValues"); }