本文整理汇总了C#中NUnit.Framework.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# NUnit.Framework.OrderBy方法的具体用法?C# NUnit.Framework.OrderBy怎么用?C# NUnit.Framework.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Framework
的用法示例。
在下文中一共展示了NUnit.Framework.OrderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddManyUnrelatedElements
public void AddManyUnrelatedElements()
{
// Arrange
var sut = new OrderedRangedSet<int>();
int[] arr = new [] { 1234, 123, 456, 5678, 789 };
// Act
foreach(int v in arr)
sut.Add(v);
// Assert
Assert.That(sut.IsEmpty, Is.False);
Assert.That(sut.Count, Is.EqualTo(arr.Length));
Assert.That(sut, Is.EquivalentTo(arr.OrderBy(i => i)));
foreach(int v in arr)
Assert.That(sut.Contains(v), Is.True);
Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Select(i => new Interval<int>(i, i + 1))));
}
示例2: AddManyUnrelatedElements
public void AddManyUnrelatedElements()
{
// Arrange
var sut = new CodePointSet();
var arr = new [] { new CodePoint(1234), new CodePoint(123), new CodePoint(456), new CodePoint(5678), new CodePoint(789) };
// Act
foreach(var v in arr)
sut.Add(v);
// Assert
Assert.That(sut.IsEmpty, Is.False);
Assert.That(sut.Count, Is.EqualTo(arr.Length));
Assert.That(sut, Is.EquivalentTo(arr.OrderBy(i => i)));
foreach(var v in arr)
Assert.That(sut.Contains(v), Is.True);
Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Select(i => new CodePointRange(i, i))));
}
示例3: Sorts_according_to_given_list
public void Sorts_according_to_given_list()
{
var l = new[] { "A", "M", "X", "Z" };
var l2 = l.OrderBy(s => s, _comparer);
l2.Should().BeEquivalentTo(_template);
}