reactivemarbles / DynamicData

Reactive collections based on Rx.Net
http://dynamic-data.org
MIT License
1.71k stars 182 forks source link

[Feature]: Inspect sorted items through `SortedChangeSetAggregator` #820

Open JakenVeina opened 8 months ago

JakenVeina commented 8 months ago

There is currently no way to test for sorting when using .AsAggregator() upon an ISortedChangeSet<TObject, TKey> stream.

Soemthing along the lines of...

using var source = new SourceCache<int, int>(x => x);

using var results = source
    .Sort(Comparer<int>.Default)
    .AsAggregator();

source.AddOrUpdate(3);
source.AddOrUpdate(2);
source.AddOrUpdate(1);

results.SortedItems.Should().BeEquivalentTo(new[] { 1, 2, 3 }, options => options.WithStrictOrdering());
JakenVeina commented 1 month ago

With #870 merged, this could potentially be implemented by deprecating the existing Aggregator classes, and publicizing the RecordingObserver classes, since they include this functionality already.