Add tests for new IYielder functionality
This commit is contained in:
Родитель
dd91d4d8eb
Коммит
72650d0019
|
@ -162,3 +162,5 @@ pip-log.txt
|
|||
# Mac crap
|
||||
.DS_Store
|
||||
Rx.NET/Source/Rx.sln.ide/
|
||||
Ix.NET/Source/Interactive Extensions.sln.ide/
|
||||
Rx.NET/tools/HomoIcon/HomoIcon.sln.ide/
|
||||
|
|
|
@ -40,6 +40,25 @@ namespace Tests
|
|||
Assert.IsTrue(hot);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CreateYield()
|
||||
{
|
||||
var xs = EnumerableEx.Create<int>(async yield => {
|
||||
var i = 0;
|
||||
while (i < 10) {
|
||||
await yield.Return(i++);
|
||||
}
|
||||
});
|
||||
|
||||
int j = 0;
|
||||
foreach (int elem in xs) {
|
||||
Assert.AreEqual(elem, j);
|
||||
j++;
|
||||
}
|
||||
|
||||
Assert.AreEqual(j, 10);
|
||||
}
|
||||
|
||||
private static IEnumerator<int> MyEnumerator()
|
||||
{
|
||||
yield return 1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче