Fix test
This commit is contained in:
parent
76de096069
commit
ba5b572d2e
@ -13,10 +13,12 @@ namespace ObservableCollections.Internal
|
||||
static readonly PropertyChangedEventArgs CountPropertyChangedEventArgs = new("Count");
|
||||
|
||||
readonly ISynchronizedView<T, TView> parent;
|
||||
readonly ISynchronizedViewFilter<T, TView> currentFilter;
|
||||
|
||||
public NotifyCollectionChangedSynchronizedView(ISynchronizedView<T, TView> parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
currentFilter = parent.CurrentFilter;
|
||||
parent.AttachFilter(this);
|
||||
}
|
||||
|
||||
@ -52,13 +54,13 @@ namespace ObservableCollections.Internal
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => parent.GetEnumerator();
|
||||
|
||||
public bool IsMatch(T value, TView view) => parent.CurrentFilter.IsMatch(value, view);
|
||||
public void WhenTrue(T value, TView view) => parent.CurrentFilter.WhenTrue(value, view);
|
||||
public void WhenFalse(T value, TView view) => parent.CurrentFilter.WhenFalse(value, view);
|
||||
public bool IsMatch(T value, TView view) => currentFilter.IsMatch(value, view);
|
||||
public void WhenTrue(T value, TView view) => currentFilter.WhenTrue(value, view);
|
||||
public void WhenFalse(T value, TView view) => currentFilter.WhenFalse(value, view);
|
||||
|
||||
public void OnCollectionChanged(ChangedKind changedKind, T value, TView view, in NotifyCollectionChangedEventArgs<T> eventArgs)
|
||||
{
|
||||
parent.CurrentFilter.OnCollectionChanged(changedKind, value, view, in eventArgs);
|
||||
currentFilter.OnCollectionChanged(changedKind, value, view, in eventArgs);
|
||||
|
||||
switch (changedKind)
|
||||
{
|
||||
|
@ -62,7 +62,6 @@ namespace ObservableCollections
|
||||
|
||||
public event NotifyCollectionChangedEventHandler<T>? CollectionChanged;
|
||||
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
lock (SyncRoot)
|
||||
|
@ -8,13 +8,13 @@ public class ToNotifyCollectionChangedTest
|
||||
var list = new ObservableList<int>();
|
||||
|
||||
list.Add(10);
|
||||
list.Add(50);
|
||||
list.Add(20);
|
||||
list.Add(30);
|
||||
|
||||
var notify = list.CreateView(x => $"${x}").ToNotifyCollectionChanged();
|
||||
|
||||
list.Add(20);
|
||||
list.Add(40);
|
||||
list.Add(50);
|
||||
|
||||
using var e = notify.GetEnumerator();
|
||||
e.MoveNext().Should().BeTrue();
|
||||
|
Loading…
x
Reference in New Issue
Block a user