mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-15 19:40:09 +00:00
Reverse
This commit is contained in:
40
src/UniTask.NetCoreTests/Linq/Projection.cs
Normal file
40
src/UniTask.NetCoreTests/Linq/Projection.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Cysharp.Threading.Tasks.Linq;
|
||||
using FluentAssertions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Concurrency;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
|
||||
namespace NetCoreTests.Linq
|
||||
{
|
||||
public class Projection
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0, 0)]
|
||||
[InlineData(0, 1)]
|
||||
[InlineData(0, 2)]
|
||||
[InlineData(0, 10)]
|
||||
public async Task Reverse(int start, int count)
|
||||
{
|
||||
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Reverse().ToArrayAsync();
|
||||
var ys = Enumerable.Range(start, count).Reverse().ToArray();
|
||||
|
||||
xs.Should().BeEquivalentTo(ys);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ReverseException()
|
||||
{
|
||||
foreach (var item in UniTaskTestException.Throws())
|
||||
{
|
||||
var xs = item.Reverse().ToArrayAsync();
|
||||
await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user