fix invalid unit tests(BeEquilvalentTo -> Equal)

master
neuecc 2021-04-06 13:02:35 +09:00
parent 89ae106ea7
commit aa3216e48d
17 changed files with 222 additions and 222 deletions

View File

@ -31,7 +31,7 @@ namespace NetCoreTests
var ar = await array; var ar = await array;
ar.Should().BeEquivalentTo(new[] { 99, 100, 100, 100, 131 }); ar.Should().Equal(new[] { 99, 100, 100, 100, 131 });
} }
[Fact] [Fact]
@ -49,7 +49,7 @@ namespace NetCoreTests
var ar = await array; var ar = await array;
ar.Should().BeEquivalentTo(new[] { 100, 100, 100, 131, 191 }); ar.Should().Equal(new[] { 100, 100, 100, 131, 191 });
} }
//[Fact] //[Fact]
@ -70,7 +70,7 @@ namespace NetCoreTests
// var ar = await array; // var ar = await array;
// ar.Should().BeEquivalentTo(new[] { 99, 100, 100, 100, 131 }); // ar.Should().Equal(new[] { 99, 100, 100, 100, 131 });
//} //}
//[Fact] //[Fact]
@ -88,7 +88,7 @@ namespace NetCoreTests
// var ar = await array; // var ar = await array;
// ar.Should().BeEquivalentTo(new[] { 100, 100, 100, 131, 191 }); // ar.Should().Equal(new[] { 100, 100, 100, 131, 191 });
//} //}

View File

@ -276,8 +276,8 @@ namespace NetCoreTests
reference.Writer.TryComplete(); reference.Writer.TryComplete();
channel.Writer.TryComplete(); channel.Writer.TryComplete();
(await ta1).Should().BeEquivalentTo(new[] { 10, 20, 30 }); (await ta1).Should().Equal(new[] { 10, 20, 30 });
(await ta2).Should().BeEquivalentTo(new[] { 10, 20, 30 }); (await ta2).Should().Equal(new[] { 10, 20, 30 });
} }
[Fact] [Fact]

View File

@ -481,7 +481,7 @@ namespace NetCoreTests.Linq
list.Add(x); list.Add(x);
}); });
list.Should().BeEquivalentTo(Enumerable.Range(1, 10)); list.Should().Equal(Enumerable.Range(1, 10));
var list2 = new List<(int, int)>(); var list2 = new List<(int, int)>();
await Enumerable.Range(5, 10).ToUniTaskAsyncEnumerable().ForEachAsync((index, x) => await Enumerable.Range(5, 10).ToUniTaskAsyncEnumerable().ForEachAsync((index, x) =>
@ -490,7 +490,7 @@ namespace NetCoreTests.Linq
}); });
var list3 = Enumerable.Range(5, 10).Select((index, x) => (index, x)).ToArray(); var list3 = Enumerable.Range(5, 10).Select((index, x) => (index, x)).ToArray();
list2.Should().BeEquivalentTo(list3); list2.Should().Equal(list3);
} }
} }
} }

View File

@ -24,7 +24,7 @@ namespace NetCoreTests.Linq
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Append(99).ToArrayAsync(); var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Append(99).ToArrayAsync();
var ys = Enumerable.Range(start, count).Append(99).ToArray(); var ys = Enumerable.Range(start, count).Append(99).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -50,7 +50,7 @@ namespace NetCoreTests.Linq
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Prepend(99).ToArrayAsync(); var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Prepend(99).ToArrayAsync();
var ys = Enumerable.Range(start, count).Prepend(99).ToArray(); var ys = Enumerable.Range(start, count).Prepend(99).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -85,7 +85,7 @@ namespace NetCoreTests.Linq
var xs = await l.ToUniTaskAsyncEnumerable().Concat(r.ToUniTaskAsyncEnumerable()).ToArrayAsync(); var xs = await l.ToUniTaskAsyncEnumerable().Concat(r.ToUniTaskAsyncEnumerable()).ToArrayAsync();
var ys = l.Concat(r).ToArray(); var ys = l.Concat(r).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -119,17 +119,17 @@ namespace NetCoreTests.Linq
{ {
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync(); var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
var ys = Enumerable.Range(1, 0).DefaultIfEmpty(99).ToArray(); var ys = Enumerable.Range(1, 0).DefaultIfEmpty(99).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync(); var xs = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
var ys = Enumerable.Range(1, 1).DefaultIfEmpty(99).ToArray(); var ys = Enumerable.Range(1, 1).DefaultIfEmpty(99).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync(); var xs = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
var ys = Enumerable.Range(1, 10).DefaultIfEmpty(99).ToArray(); var ys = Enumerable.Range(1, 10).DefaultIfEmpty(99).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
// Throw // Throw
{ {

View File

@ -34,11 +34,11 @@ namespace NetCoreTests.Linq
{ {
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, 10).ToObservable().ToArray(); var xs = await UniTaskAsyncEnumerable.Range(1, 10).ToObservable().ToArray();
xs.Should().BeEquivalentTo(Enumerable.Range(1, 10)); xs.Should().Equal(Enumerable.Range(1, 10));
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, 0).ToObservable().ToArray(); var xs = await UniTaskAsyncEnumerable.Range(1, 0).ToObservable().ToArray();
xs.Should().BeEquivalentTo(Enumerable.Range(1, 0)); xs.Should().Equal(Enumerable.Range(1, 0));
} }
} }
@ -70,21 +70,21 @@ namespace NetCoreTests.Linq
var xs = await Observable.Range(1, 100).ToUniTaskAsyncEnumerable().ToArrayAsync(); var xs = await Observable.Range(1, 100).ToUniTaskAsyncEnumerable().ToArrayAsync();
var ys = await Observable.Range(1, 100).ToArray(); var ys = await Observable.Range(1, 100).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync(); var xs = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();
var ys = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToArray(); var ys = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync(); var xs = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();
var ys = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToArray(); var ys = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
@ -95,25 +95,25 @@ namespace NetCoreTests.Linq
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x); var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);
var ys = Enumerable.Range(1, 100).ToDictionary(x => x); var ys = Enumerable.Range(1, 100).ToDictionary(x => x);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
{ {
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x); var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);
var ys = Enumerable.Range(1, 0).ToDictionary(x => x); var ys = Enumerable.Range(1, 0).ToDictionary(x => x);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
{ {
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2); var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);
var ys = Enumerable.Range(1, 100).ToDictionary(x => x, x => x * 2); var ys = Enumerable.Range(1, 100).ToDictionary(x => x, x => x * 2);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
{ {
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2); var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);
var ys = Enumerable.Range(1, 0).ToDictionary(x => x, x => x * 2); var ys = Enumerable.Range(1, 0).ToDictionary(x => x, x => x * 2);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
} }
@ -126,34 +126,34 @@ namespace NetCoreTests.Linq
var ys = arr.ToLookup(x => x); var ys = arr.ToLookup(x => x);
xs.Count.Should().Be(ys.Count); xs.Count.Should().Be(ys.Count);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
foreach (var key in xs.Select(x => x.Key)) foreach (var key in xs.Select(x => x.Key))
{ {
xs[key].Should().BeEquivalentTo(ys[key]); xs[key].Should().Equal(ys[key]);
} }
} }
{ {
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x); var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x);
var ys = Enumerable.Range(1, 0).ToLookup(x => x); var ys = Enumerable.Range(1, 0).ToLookup(x => x);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
{ {
var xs = await arr.ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2); var xs = await arr.ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);
var ys = arr.ToLookup(x => x, x => x * 2); var ys = arr.ToLookup(x => x, x => x * 2);
xs.Count.Should().Be(ys.Count); xs.Count.Should().Be(ys.Count);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
foreach (var key in xs.Select(x => x.Key)) foreach (var key in xs.Select(x => x.Key))
{ {
xs[key].Should().BeEquivalentTo(ys[key]); xs[key].Should().Equal(ys[key]);
} }
} }
{ {
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2); var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);
var ys = Enumerable.Range(1, 0).ToLookup(x => x, x => x * 2); var ys = Enumerable.Range(1, 0).ToLookup(x => x, x => x * 2);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
} }
@ -164,13 +164,13 @@ namespace NetCoreTests.Linq
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToListAsync(); var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToListAsync();
var ys = Enumerable.Range(1, 100).ToList(); var ys = Enumerable.Range(1, 100).ToList();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToListAsync(); var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToListAsync();
var ys = Enumerable.Empty<int>().ToList(); var ys = Enumerable.Empty<int>().ToList();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
@ -181,13 +181,13 @@ namespace NetCoreTests.Linq
var xs = await new[] { 1, 20, 4, 5, 20, 4, 6 }.ToUniTaskAsyncEnumerable().ToHashSetAsync(); var xs = await new[] { 1, 20, 4, 5, 20, 4, 6 }.ToUniTaskAsyncEnumerable().ToHashSetAsync();
var ys = new[] { 1, 20, 4, 5, 20, 4, 6 }.ToHashSet(); var ys = new[] { 1, 20, 4, 5, 20, 4, 6 }.ToHashSet();
xs.OrderBy(x => x).Should().BeEquivalentTo(ys.OrderBy(x => x)); xs.OrderBy(x => x).Should().Equal(ys.OrderBy(x => x));
} }
{ {
var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToHashSetAsync(); var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToHashSetAsync();
var ys = Enumerable.Empty<int>().ToHashSet(); var ys = Enumerable.Empty<int>().ToHashSet();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
} }

View File

@ -30,7 +30,7 @@ namespace NetCoreTests.Linq
var ys = await Range(from, count).AsUniTaskAsyncEnumerable().ToArrayAsync(); var ys = await Range(from, count).AsUniTaskAsyncEnumerable().ToArrayAsync();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -57,19 +57,19 @@ namespace NetCoreTests.Linq
list.Should().BeEmpty(); list.Should().BeEmpty();
await e.MoveNextAsync(); await e.MoveNextAsync();
list.Should().BeEquivalentTo(100); list.Should().Equal(100);
e.Current.Should().Be(10); e.Current.Should().Be(10);
await e.MoveNextAsync(); await e.MoveNextAsync();
list.Should().BeEquivalentTo(100, 200); list.Should().Equal(100, 200);
e.Current.Should().Be(20); e.Current.Should().Be(20);
await e.MoveNextAsync(); await e.MoveNextAsync();
list.Should().BeEquivalentTo(100, 200, 300); list.Should().Equal(100, 200, 300);
e.Current.Should().Be(30); e.Current.Should().Be(30);
(await e.MoveNextAsync()).Should().BeFalse(); (await e.MoveNextAsync()).Should().BeFalse();
list.Should().BeEquivalentTo(100, 200, 300, 400); list.Should().Equal(100, 200, 300, 400);
} }
[Fact] [Fact]
@ -144,19 +144,19 @@ namespace NetCoreTests.Linq
list.Should().BeEmpty(); list.Should().BeEmpty();
await e.MoveNextAsync(); await e.MoveNextAsync();
list.Should().BeEquivalentTo(100); list.Should().Equal(100);
e.Current.Should().Be(10); e.Current.Should().Be(10);
await e.MoveNextAsync(); await e.MoveNextAsync();
list.Should().BeEquivalentTo(100, 200); list.Should().Equal(100, 200);
e.Current.Should().Be(20); e.Current.Should().Be(20);
await e.MoveNextAsync(); await e.MoveNextAsync();
list.Should().BeEquivalentTo(100, 200, 300); list.Should().Equal(100, 200, 300);
e.Current.Should().Be(30); e.Current.Should().Be(30);
(await e.MoveNextAsync()).Should().BeFalse(); (await e.MoveNextAsync()).Should().BeFalse();
list.Should().BeEquivalentTo(100, 200, 300, 400); list.Should().Equal(100, 200, 300, 400);
} }
async IAsyncEnumerable<int> Range(int from, int count) async IAsyncEnumerable<int> Range(int from, int count)

View File

@ -22,7 +22,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(start, count).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(start, count).ToArrayAsync();
var ys = Enumerable.Range(start, count).ToArray(); var ys = Enumerable.Range(start, count).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Theory] [Theory]
@ -36,7 +36,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Repeat(value, count).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Repeat(value, count).ToArrayAsync();
var ys = Enumerable.Repeat(value, count).ToArray(); var ys = Enumerable.Repeat(value, count).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -45,7 +45,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Empty<int>().ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Empty<int>().ToArrayAsync();
var ys = Enumerable.Empty<int>().ToArray(); var ys = Enumerable.Empty<int>().ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Theory] [Theory]

View File

@ -23,26 +23,26 @@ namespace NetCoreTests.Linq
{ {
var a = await src.Where(x => x % 2 == 0).ToArrayAsync(); var a = await src.Where(x => x % 2 == 0).ToArrayAsync();
var expected = range.Where(x => x % 2 == 0).ToArray(); var expected = range.Where(x => x % 2 == 0).ToArray();
a.Should().BeEquivalentTo(expected); a.Should().Equal(expected);
} }
{ {
var a = await src.Where((x, i) => (x + i) % 2 == 0).ToArrayAsync(); var a = await src.Where((x, i) => (x + i) % 2 == 0).ToArrayAsync();
var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray(); var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();
a.Should().BeEquivalentTo(expected); a.Should().Equal(expected);
} }
{ {
var a = await src.WhereAwait(x => UniTask.Run(() => x % 2 == 0)).ToArrayAsync(); var a = await src.WhereAwait(x => UniTask.Run(() => x % 2 == 0)).ToArrayAsync();
var b = await src.WhereAwait(x => UniTask.FromResult(x % 2 == 0)).ToArrayAsync(); var b = await src.WhereAwait(x => UniTask.FromResult(x % 2 == 0)).ToArrayAsync();
var expected = range.Where(x => x % 2 == 0).ToArray(); var expected = range.Where(x => x % 2 == 0).ToArray();
a.Should().BeEquivalentTo(expected); a.Should().Equal(expected);
b.Should().BeEquivalentTo(expected); b.Should().Equal(expected);
} }
{ {
var a = await src.WhereAwait((x, i) => UniTask.Run(() => (x + i) % 2 == 0)).ToArrayAsync(); var a = await src.WhereAwait((x, i) => UniTask.Run(() => (x + i) % 2 == 0)).ToArrayAsync();
var b = await src.WhereAwait((x, i) => UniTask.FromResult((x + i) % 2 == 0)).ToArrayAsync(); var b = await src.WhereAwait((x, i) => UniTask.FromResult((x + i) % 2 == 0)).ToArrayAsync();
var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray(); var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();
a.Should().BeEquivalentTo(expected); a.Should().Equal(expected);
b.Should().BeEquivalentTo(expected); b.Should().Equal(expected);
} }
} }
@ -79,7 +79,7 @@ namespace NetCoreTests.Linq
var a = await data.ToUniTaskAsyncEnumerable().OfType<int>().ToArrayAsync(); var a = await data.ToUniTaskAsyncEnumerable().OfType<int>().ToArrayAsync();
var b = data.OfType<int>().ToArray(); var b = data.OfType<int>().ToArray();
a.Should().BeEquivalentTo(b); a.Should().Equal(b);
} }
@ -101,7 +101,7 @@ namespace NetCoreTests.Linq
var a = await data.ToUniTaskAsyncEnumerable().Cast<int>().ToArrayAsync(); var a = await data.ToUniTaskAsyncEnumerable().Cast<int>().ToArrayAsync();
var b = data.Cast<int>().ToArray(); var b = data.Cast<int>().ToArray();
a.Should().BeEquivalentTo(b); a.Should().Equal(b);
} }

View File

@ -38,7 +38,7 @@ namespace NetCoreTests.Linq
var xs = await outer.ToUniTaskAsyncEnumerable().Join(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => (x, y)).ToArrayAsync(); var xs = await outer.ToUniTaskAsyncEnumerable().Join(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => (x, y)).ToArrayAsync();
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray(); var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
@ -66,7 +66,7 @@ namespace NetCoreTests.Linq
var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, y))).ToArrayAsync(); var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, y))).ToArrayAsync();
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray(); var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
@ -94,7 +94,7 @@ namespace NetCoreTests.Linq
var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, y))).ToArrayAsync(); var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, y))).ToArrayAsync();
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray(); var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
@ -123,7 +123,7 @@ namespace NetCoreTests.Linq
var ys = arr.GroupBy(x => x).ToArray(); var ys = arr.GroupBy(x => x).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
{ {
@ -131,7 +131,7 @@ namespace NetCoreTests.Linq
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray(); var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().BeEquivalentTo(ys.OrderBy(x => x.key).SelectMany(x => x.Item2)); xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
} }
{ {
@ -139,7 +139,7 @@ namespace NetCoreTests.Linq
var ys = arr.GroupBy(x => x).ToArray(); var ys = arr.GroupBy(x => x).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
{ {
@ -147,7 +147,7 @@ namespace NetCoreTests.Linq
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray(); var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().BeEquivalentTo(ys.OrderBy(x => x.key).SelectMany(x => x.Item2)); xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
} }
{ {
@ -155,7 +155,7 @@ namespace NetCoreTests.Linq
var ys = arr.GroupBy(x => x).ToArray(); var ys = arr.GroupBy(x => x).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key)); xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
} }
{ {
@ -163,7 +163,7 @@ namespace NetCoreTests.Linq
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray(); var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().BeEquivalentTo(ys.OrderBy(x => x.key).SelectMany(x => x.Item2)); xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
} }
} }
@ -199,21 +199,21 @@ namespace NetCoreTests.Linq
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray(); var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync(); var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync();
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray(); var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync(); var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync();
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray(); var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
xs.Length.Should().Be(ys.Length); xs.Length.Should().Be(ys.Length);
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }

View File

@ -27,7 +27,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(1, collection).Skip(skipCount).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).Skip(skipCount).ToArrayAsync();
var ys = Enumerable.Range(1, collection).Skip(skipCount).ToArray(); var ys = Enumerable.Range(1, collection).Skip(skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -52,7 +52,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipLast(skipCount).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipLast(skipCount).ToArrayAsync();
var ys = Enumerable.Range(1, collection).SkipLast(skipCount).ToArray(); var ys = Enumerable.Range(1, collection).SkipLast(skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -77,7 +77,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeLast(takeCount).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeLast(takeCount).ToArrayAsync();
var ys = Enumerable.Range(1, collection).TakeLast(takeCount).ToArray(); var ys = Enumerable.Range(1, collection).TakeLast(takeCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -103,7 +103,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(1, collection).Take(takeCount).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).Take(takeCount).ToArrayAsync();
var ys = Enumerable.Range(1, collection).Take(takeCount).ToArray(); var ys = Enumerable.Range(1, collection).Take(takeCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -130,37 +130,37 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArrayAsync();
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray(); var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArrayAsync();
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray(); var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray(); var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray(); var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray(); var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray(); var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
@ -213,37 +213,37 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArrayAsync();
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray(); var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArrayAsync();
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray(); var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray(); var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray(); var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray(); var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray(); var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }

View File

@ -24,7 +24,7 @@ namespace NetCoreTests.Linq
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Reverse().ToArrayAsync(); var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Reverse().ToArrayAsync();
var ys = Enumerable.Range(start, count).Reverse().ToArray(); var ys = Enumerable.Range(start, count).Reverse().ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -46,18 +46,18 @@ namespace NetCoreTests.Linq
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, count).Select(x => x * x).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, count).Select(x => x * x).ToArrayAsync();
var ys = Enumerable.Range(1, count).Select(x => x * x).ToArray(); var ys = Enumerable.Range(1, count).Select(x => x * x).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x) => UniTask.Run(() => x * x)).ToArrayAsync(); var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x) => UniTask.Run(() => x * x)).ToArrayAsync();
zs.Should().BeEquivalentTo(ys); zs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, count).Select((x, i) => x * x * i).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, count).Select((x, i) => x * x * i).ToArrayAsync();
var ys = Enumerable.Range(1, count).Select((x, i) => x * x * i).ToArray(); var ys = Enumerable.Range(1, count).Select((x, i) => x * x * i).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x, i) => UniTask.Run(() => x * x * i)).ToArrayAsync(); var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x, i) => UniTask.Run(() => x * x * i)).ToArrayAsync();
zs.Should().BeEquivalentTo(ys); zs.Should().Equal(ys);
} }
} }
@ -98,22 +98,22 @@ namespace NetCoreTests.Linq
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x)).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x), (x, y) => x * y).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x), (x, y) => x * y).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
// await // await
@ -121,22 +121,22 @@ namespace NetCoreTests.Linq
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
// with cancel // with cancel
@ -144,22 +144,22 @@ namespace NetCoreTests.Linq
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray(); var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
@ -219,17 +219,17 @@ namespace NetCoreTests.Linq
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).Zip(UniTaskAsyncEnumerable.Range(99, rightCount)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).Zip(UniTaskAsyncEnumerable.Range(99, rightCount)).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray(); var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwait(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y) => UniTask.Run(() => (x, y))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwait(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y) => UniTask.Run(() => (x, y))).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray(); var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwaitWithCancellation(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y, _) => UniTask.Run(() => (x, y))).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwaitWithCancellation(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y, _) => UniTask.Run(() => (x, y))).ToArrayAsync();
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray(); var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
[Fact] [Fact]
@ -288,7 +288,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync();
var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync(); var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Theory] [Theory]
@ -305,7 +305,7 @@ namespace NetCoreTests.Linq
var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync();
var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync(); var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
[Fact] [Fact]
@ -402,7 +402,7 @@ namespace NetCoreTests.Linq
public async Task PariwiseImmediate() public async Task PariwiseImmediate()
{ {
var xs = await UniTaskAsyncEnumerable.Range(1, 5).Pairwise().ToArrayAsync(); var xs = await UniTaskAsyncEnumerable.Range(1, 5).Pairwise().ToArrayAsync();
xs.Should().BeEquivalentTo((1, 2), (2, 3), (3, 4), (4, 5)); xs.Should().Equal((1, 2), (2, 3), (3, 4), (4, 5));
} }
[Fact] [Fact]
@ -426,7 +426,7 @@ namespace NetCoreTests.Linq
await complete; await complete;
list.Should().BeEquivalentTo((10, 20), (20, 30), (30, 40), (40, 50)); list.Should().Equal((10, 20), (20, 30), (30, 40), (40, 50));
} }
class MyException : Exception class MyException : Exception

View File

@ -26,7 +26,7 @@ namespace NetCoreTests.Linq
rp.Value = 2; rp.Value = 2;
(await b).Should().BeEquivalentTo(1, 2); (await b).Should().Equal(1, 2);
var c = multicast.ToArrayAsync(); var c = multicast.ToArrayAsync();
@ -36,8 +36,8 @@ namespace NetCoreTests.Linq
rp.Dispose(); rp.Dispose();
(await a).Should().BeEquivalentTo(1, 2, 3, 4, 5); (await a).Should().Equal(1, 2, 3, 4, 5);
(await c).Should().BeEquivalentTo(3, 4, 5); (await c).Should().Equal(3, 4, 5);
disp.Dispose(); disp.Dispose();
} }
@ -56,7 +56,7 @@ namespace NetCoreTests.Linq
rp.Value = 2; rp.Value = 2;
(await b).Should().BeEquivalentTo(1, 2); (await b).Should().Equal(1, 2);
var c = multicast.ToArrayAsync(); var c = multicast.ToArrayAsync();

View File

@ -23,7 +23,7 @@ namespace NetCoreTests.Linq
l.Add(x); l.Add(x);
}); });
l.Should().BeEquivalentTo(100, 110, 120, 130, 140, 150, 160, 170, 180, 190); l.Should().Equal(100, 110, 120, 130, 140, 150, 160, 170, 180, 190);
} }
} }
} }

View File

@ -34,10 +34,10 @@ namespace NetCoreTests.Linq
{ {
var ys = array.Distinct().ToArray(); var ys = array.Distinct().ToArray();
{ {
(await array.ToUniTaskAsyncEnumerable().Distinct().ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().Distinct().ToArrayAsync()).Should().Equal(ys);
(await array.ToUniTaskAsyncEnumerable().Distinct(x => x).ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().Distinct(x => x).ToArrayAsync()).Should().Equal(ys);
(await array.ToUniTaskAsyncEnumerable().DistinctAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().DistinctAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
(await array.ToUniTaskAsyncEnumerable().DistinctAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().DistinctAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
} }
} }
@ -71,10 +71,10 @@ namespace NetCoreTests.Linq
{ {
var ys = await array.ToAsyncEnumerable().DistinctUntilChanged().ToArrayAsync(); var ys = await array.ToAsyncEnumerable().DistinctUntilChanged().ToArrayAsync();
{ {
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged().ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged().ToArrayAsync()).Should().Equal(ys);
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged(x => x).ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged(x => x).ToArrayAsync()).Should().Equal(ys);
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys); (await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
} }
} }
@ -112,7 +112,7 @@ namespace NetCoreTests.Linq
{ {
var xs = await a1.ToUniTaskAsyncEnumerable().Except(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync(); var xs = await a1.ToUniTaskAsyncEnumerable().Except(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
var ys = a1.Except(a2).ToArray(); var ys = a1.Except(a2).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
} }
@ -141,7 +141,7 @@ namespace NetCoreTests.Linq
{ {
var xs = await a1.ToUniTaskAsyncEnumerable().Intersect(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync(); var xs = await a1.ToUniTaskAsyncEnumerable().Intersect(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
var ys = a1.Intersect(a2).ToArray(); var ys = a1.Intersect(a2).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
} }
@ -170,7 +170,7 @@ namespace NetCoreTests.Linq
{ {
var xs = await a1.ToUniTaskAsyncEnumerable().Union(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync(); var xs = await a1.ToUniTaskAsyncEnumerable().Union(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
var ys = a1.Union(a2).ToArray(); var ys = a1.Union(a2).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
} }

View File

@ -59,32 +59,32 @@ namespace NetCoreTests.Linq
{ {
var xs = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x).ToArrayAsync(); var xs = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x).ToArrayAsync();
var ys = array.OrderBy(x => x).ToArray(); var ys = array.OrderBy(x => x).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x).ToArrayAsync(); var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x).ToArrayAsync();
var ys = array.OrderByDescending(x => x).ToArray(); var ys = array.OrderByDescending(x => x).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwait(RandomRun).ToArrayAsync(); var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwait(RandomRun).ToArrayAsync();
var ys = array.OrderBy(x => x).ToArray(); var ys = array.OrderBy(x => x).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(RandomRun).ToArrayAsync(); var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(RandomRun).ToArrayAsync();
var ys = array.OrderByDescending(x => x).ToArray(); var ys = array.OrderByDescending(x => x).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation(RandomRun).ToArrayAsync(); var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation(RandomRun).ToArrayAsync();
var ys = array.OrderBy(x => x).ToArray(); var ys = array.OrderBy(x => x).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
{ {
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation(RandomRun).ToArrayAsync(); var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation(RandomRun).ToArrayAsync();
var ys = array.OrderByDescending(x => x).ToArray(); var ys = array.OrderByDescending(x => x).ToArray();
xs.Should().BeEquivalentTo(ys); xs.Should().Equal(ys);
} }
} }
@ -125,14 +125,14 @@ namespace NetCoreTests.Linq
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync(); var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync();
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync(); var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync();
a.Should().BeEquivalentTo(a2); a.Should().Equal(a2);
b.Should().BeEquivalentTo(b2); b.Should().Equal(b2);
c.Should().BeEquivalentTo(c2); c.Should().Equal(c2);
d.Should().BeEquivalentTo(d2); d.Should().Equal(d2);
e.Should().BeEquivalentTo(e2); e.Should().Equal(e2);
f.Should().BeEquivalentTo(f2); f.Should().Equal(f2);
g.Should().BeEquivalentTo(g2); g.Should().Equal(g2);
h.Should().BeEquivalentTo(h2); h.Should().Equal(h2);
} }
{ {
var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync(); var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();
@ -144,14 +144,14 @@ namespace NetCoreTests.Linq
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync(); var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync(); var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync();
a.Should().BeEquivalentTo(a2); a.Should().Equal(a2);
b.Should().BeEquivalentTo(b2); b.Should().Equal(b2);
c.Should().BeEquivalentTo(c2); c.Should().Equal(c2);
d.Should().BeEquivalentTo(d2); d.Should().Equal(d2);
e.Should().BeEquivalentTo(e2); e.Should().Equal(e2);
f.Should().BeEquivalentTo(f2); f.Should().Equal(f2);
g.Should().BeEquivalentTo(g2); g.Should().Equal(g2);
h.Should().BeEquivalentTo(h2); h.Should().Equal(h2);
} }
{ {
var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync(); var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
@ -163,14 +163,14 @@ namespace NetCoreTests.Linq
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync(); var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync(); var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
a.Should().BeEquivalentTo(a2); a.Should().Equal(a2);
b.Should().BeEquivalentTo(b2); b.Should().Equal(b2);
c.Should().BeEquivalentTo(c2); c.Should().Equal(c2);
d.Should().BeEquivalentTo(d2); d.Should().Equal(d2);
e.Should().BeEquivalentTo(e2); e.Should().Equal(e2);
f.Should().BeEquivalentTo(f2); f.Should().Equal(f2);
g.Should().BeEquivalentTo(g2); g.Should().Equal(g2);
h.Should().BeEquivalentTo(h2); h.Should().Equal(h2);
} }
} }
} }

View File

@ -24,7 +24,7 @@ namespace NetCoreTests.Linq
rp.Value = 4; rp.Value = 4;
rp.Value = 5; rp.Value = 5;
(await xs).Should().BeEquivalentTo(1, 2, 3, 4, 5); (await xs).Should().Equal(1, 2, 3, 4, 5);
} }
[Fact] [Fact]
@ -39,7 +39,7 @@ namespace NetCoreTests.Linq
rp.Value = 4; rp.Value = 4;
rp.Value = 5; rp.Value = 5;
(await xs).Should().BeEquivalentTo(1, 2, 3, 4); (await xs).Should().Equal(1, 2, 3, 4);
} }
[Fact] [Fact]
@ -56,7 +56,7 @@ namespace NetCoreTests.Linq
await c; await c;
var foo = await xs; var foo = await xs;
foo.Should().BeEquivalentTo(new[] { 1, 10, 20 }); foo.Should().Equal(new[] { 1, 10, 20 });
async Task CancelAsync() async Task CancelAsync()
{ {
@ -85,7 +85,7 @@ namespace NetCoreTests.Linq
await c; await c;
var foo = await xs; var foo = await xs;
foo.Should().BeEquivalentTo(new[] { 20, 30, 40 }); foo.Should().Equal(new[] { 20, 30, 40 });
async Task CancelAsync() async Task CancelAsync()
{ {
@ -116,7 +116,7 @@ namespace NetCoreTests.Linq
await c; await c;
var foo = await xs; var foo = await xs;
foo.Should().BeEquivalentTo(new[] { 1, 10, 20 }); foo.Should().Equal(new[] { 1, 10, 20 });
async Task CancelAsync() async Task CancelAsync()
{ {
@ -145,7 +145,7 @@ namespace NetCoreTests.Linq
await c; await c;
var foo = await xs; var foo = await xs;
foo.Should().BeEquivalentTo(new[] { 20, 30, 40 }); foo.Should().Equal(new[] { 20, 30, 40 });
async Task CancelAsync() async Task CancelAsync()
{ {

View File

@ -34,7 +34,7 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
ev.SetCompleted(); ev.SetCompleted();
@ -46,7 +46,7 @@ namespace NetCoreTests
ev.SetCompleted(); ev.SetCompleted();
ev.SetCanceled(default); ev.SetCanceled(default);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
one.CompletedCalled.Count.Should().Be(1); one.CompletedCalled.Count.Should().Be(1);
} }
// after removed, onemore // after removed, onemore
@ -59,7 +59,7 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
ev.SetCompleted(); ev.SetCompleted();
@ -71,7 +71,7 @@ namespace NetCoreTests
ev.SetCompleted(); ev.SetCompleted();
ev.SetCanceled(default); ev.SetCanceled(default);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
one.CompletedCalled.Count.Should().Be(1); one.CompletedCalled.Count.Should().Be(1);
} }
} }
@ -102,10 +102,10 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
four.NextCalled.Should().BeEquivalentTo(10, 20, 30); four.NextCalled.Should().Equal(10, 20, 30);
ev.SetCompleted(); ev.SetCompleted();
@ -120,11 +120,11 @@ namespace NetCoreTests
ev.SetCompleted(); ev.SetCompleted();
ev.SetCanceled(default); ev.SetCanceled(default);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
one.CompletedCalled.Count.Should().Be(1); one.CompletedCalled.Count.Should().Be(1);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.CompletedCalled.Count.Should().Be(1); three.CompletedCalled.Count.Should().Be(1);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.CompletedCalled.Count.Should().Be(1); three.CompletedCalled.Count.Should().Be(1);
} }
@ -145,10 +145,10 @@ namespace NetCoreTests
ev.SetResult(30); ev.SetResult(30);
ev.Add(four); ev.Add(four);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
four.NextCalled.Should().BeEquivalentTo(10, 20, 30); four.NextCalled.Should().Equal(10, 20, 30);
ev.SetCompleted(); ev.SetCompleted();
@ -163,11 +163,11 @@ namespace NetCoreTests
ev.SetCompleted(); ev.SetCompleted();
ev.SetCanceled(default); ev.SetCanceled(default);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
one.CompletedCalled.Count.Should().Be(1); one.CompletedCalled.Count.Should().Be(1);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.CompletedCalled.Count.Should().Be(1); three.CompletedCalled.Count.Should().Be(1);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.CompletedCalled.Count.Should().Be(1); three.CompletedCalled.Count.Should().Be(1);
} }
} }
@ -190,9 +190,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
ev.Remove(one); ev.Remove(one);
@ -200,9 +200,9 @@ namespace NetCoreTests
ev.SetResult(50); ev.SetResult(50);
ev.SetResult(60); ev.SetResult(60);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60); two.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60); three.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
} }
} }
[Fact] [Fact]
@ -222,9 +222,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
ev.Remove(two); ev.Remove(two);
@ -232,9 +232,9 @@ namespace NetCoreTests
ev.SetResult(50); ev.SetResult(50);
ev.SetResult(60); ev.SetResult(60);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60); one.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60); three.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
} }
} }
[Fact] [Fact]
@ -254,9 +254,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
ev.Remove(three); ev.Remove(three);
@ -264,9 +264,9 @@ namespace NetCoreTests
ev.SetResult(50); ev.SetResult(50);
ev.SetResult(60); ev.SetResult(60);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60); one.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60); two.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
} }
} }
@ -321,9 +321,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10); one.NextCalled.Should().Equal(10);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
} }
public void Run2() public void Run2()
@ -342,9 +342,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10); one.NextCalled.Should().Equal(10);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
} }
public void Run3() public void Run3()
@ -363,9 +363,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10); one.NextCalled.Should().Equal(10);
two.NextCalled.Should().BeEquivalentTo(10, 20, 30); two.NextCalled.Should().Equal(10, 20, 30);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
} }
} }
@ -390,9 +390,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Count.Should().Be(0); two.NextCalled.Count.Should().Be(0);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
} }
public void Run2() public void Run2()
@ -412,9 +412,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10); two.NextCalled.Should().Equal(10);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
} }
public void Run3() public void Run3()
@ -434,9 +434,9 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Should().BeEquivalentTo(10); two.NextCalled.Should().Equal(10);
three.NextCalled.Should().BeEquivalentTo(10, 20, 30); three.NextCalled.Should().Equal(10, 20, 30);
} }
} }
@ -464,10 +464,10 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30); one.NextCalled.Should().Equal(10, 20, 30);
two.NextCalled.Count.Should().Be(0); two.NextCalled.Count.Should().Be(0);
three.NextCalled.Count.Should().Be(0); three.NextCalled.Count.Should().Be(0);
four.NextCalled.Should().BeEquivalentTo(10, 20, 30); four.NextCalled.Should().Equal(10, 20, 30);
} }
public void Run2() public void Run2()
@ -490,10 +490,10 @@ namespace NetCoreTests
ev.SetResult(20); ev.SetResult(20);
ev.SetResult(30); ev.SetResult(30);
one.NextCalled.Should().BeEquivalentTo(10); one.NextCalled.Should().Equal(10);
two.NextCalled.Count.Should().Be(0); two.NextCalled.Count.Should().Be(0);
three.NextCalled.Count.Should().Be(0); three.NextCalled.Count.Should().Be(0);
four.NextCalled.Should().BeEquivalentTo(10, 20, 30); four.NextCalled.Should().Equal(10, 20, 30);
} }
@ -533,10 +533,10 @@ namespace NetCoreTests
ev.SetResult(30); ev.SetResult(30);
ev.SetResult(40); ev.SetResult(40);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40); one.NextCalled.Should().Equal(10, 20, 30, 40);
two.NextCalled.Should().BeEquivalentTo(20, 30, 40); two.NextCalled.Should().Equal(20, 30, 40);
three.NextCalled.Should().BeEquivalentTo(30, 40); three.NextCalled.Should().Equal(30, 40);
four.NextCalled.Should().BeEquivalentTo(40); four.NextCalled.Should().Equal(40);
} }
public void Run2() public void Run2()
@ -573,10 +573,10 @@ namespace NetCoreTests
ev.SetResult(30); ev.SetResult(30);
ev.SetResult(40); ev.SetResult(40);
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40); one.NextCalled.Should().Equal(10, 20, 30, 40);
two.NextCalled.Should().BeEquivalentTo(20, 30, 40); two.NextCalled.Should().Equal(20, 30, 40);
three.NextCalled.Should().BeEquivalentTo(30, 40); three.NextCalled.Should().Equal(30, 40);
four.NextCalled.Should().BeEquivalentTo(40); four.NextCalled.Should().Equal(40);
} }
} }
} }