Permalink
Browse files

TaskSample - TwoItemsFirstMatchesSyncReturns

  • Loading branch information...
bobbymcr committed May 23, 2018
1 parent 26d5784 commit 00d65a5bbbcdc749aa0b23dd52fb9a343e376b1f
Showing with 15 additions and 0 deletions.
  1. +15 −0 projects/TaskSample/TaskSample.Test/FirstAsyncTest.cs
@@ -27,5 +27,20 @@ public void OneItemMatchesSyncReturns()
task.IsCompletedSuccessfully.Should().BeTrue();
task.Result.Should().Be("good");
}
[Fact]
public void TwoItemsFirstMatchesSyncReturns()
{
IEnumerable<Func<CancellationToken, Task<string>>> funcs = new Func<CancellationToken, Task<string>>[]
{
t => Task.FromResult("good 1"),
t => Task.FromResult("good 2")
};
Task<string> task = funcs.FirstAsync(r => true);
task.IsCompletedSuccessfully.Should().BeTrue();
task.Result.Should().Be("good 1");
}
}
}

0 comments on commit 00d65a5

Please sign in to comment.