/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Http/Headers/test/StringWithQualityHeaderValueComparerTest.cs
59 строк
2 KB
Shreyas Jejurkar
chore : Remove unwanted `using` statement (#39176)
02 янв 2022, 17:39
Не верифицирован
02 янв 2022, 17:39
c85baf8
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.Net.Http.Headers; public class StringWithQualityHeaderValueComparerTest { public static TheoryData<string[], string[]> StringWithQualityHeaderValueComparerTestsBeforeAfterSortedValues { get { return new TheoryData<string[], string[]> { { new string[] { "text", "text;q=1.0", "text", "text;q=0", "*;q=0.8", "*;q=1", "text;q=0.8", "*;q=0.6", "text;q=1.0", "*;q=0.4", "text;q=0.6", }, new string[] { "text", "text;q=1.0", "text", "text;q=1.0", "*;q=1", "text;q=0.8", "*;q=0.8", "text;q=0.6", "*;q=0.6", "*;q=0.4", "text;q=0", } } }; } } [Theory] [MemberData(nameof(StringWithQualityHeaderValueComparerTestsBeforeAfterSortedValues))] public void SortStringWithQualityHeaderValuesByQFactor_SortsCorrectly(IEnumerable<string> unsorted, IEnumerable<string> expectedSorted) { var unsortedValues = StringWithQualityHeaderValue.ParseList(unsorted.ToList()); var expectedSortedValues = StringWithQualityHeaderValue.ParseList(expectedSorted.ToList()); var actualSorted = unsortedValues.OrderByDescending(k => k, StringWithQualityHeaderValueComparer.QualityComparer).ToList(); Assert.True(expectedSortedValues.SequenceEqual(actualSorted)); } }