本文整理汇总了C#中NUnit.Framework.Select方法的典型用法代码示例。如果您正苦于以下问题:C# NUnit.Framework.Select方法的具体用法?C# NUnit.Framework.Select怎么用?C# NUnit.Framework.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Framework
的用法示例。
在下文中一共展示了NUnit.Framework.Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Roslyn_DynamicIEnumerable
public void Roslyn_DynamicIEnumerable()
{
RunTestHelper(service =>
{
const string template = @"@Enumerable.Count(Model.Data)";
const string expected = "3";
var anonArray = new[] { new { InnerData = 1 }, new { InnerData = 2 }, new { InnerData = 3 } };
var model = new { Data = anonArray.Select(a => a) };
string result = service.RunCompile(template, "test", null, model, null);
Assert.That(result == expected, "Result does not match expected: " + result);
});
}
示例2: 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))));
}
示例3: 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))));
}
示例4: Roslyn_AnonymousTypeWithinTemplate
public void Roslyn_AnonymousTypeWithinTemplate()
{
RunTestHelper(service =>
{
const string template_child = "@Enumerable.Count(Model.Data)";
const string template_parent = @"@Include(""Child"", new { Data = Model.Data})";
const string expected = "3";
service.Compile(template_child, "Child", null);
var anonArray = new[] { new { InnerData = 1 }, new { InnerData = 2 }, new { InnerData = 3 } };
var model = new { Data = anonArray.Select(a => a) };
string result = service.RunCompile(template_parent, "test", null, model, null);
Assert.That(result == expected, "Result does not match expected: " + result);
});
}