diff --git a/src/DynamicData.Tests/Binding/ObservableCollectionBindCacheFixture.cs b/src/DynamicData.Tests/Binding/ObservableCollectionBindCacheFixture.cs index 966e963db..dbc633907 100644 --- a/src/DynamicData.Tests/Binding/ObservableCollectionBindCacheFixture.cs +++ b/src/DynamicData.Tests/Binding/ObservableCollectionBindCacheFixture.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Specialized; using System.Linq; +using System.Reactive.Linq; using DynamicData.Binding; using DynamicData.Tests.Domain; using FluentAssertions; @@ -49,6 +51,25 @@ public void UpdateToSourceUpdatesTheDestination() _collection.First().Should().Be(personUpdated, "Should be updated person"); } + [Fact] + public void UpdateToSourceSendsReplaceOnDestination() + { + var person = new Person("Adult1", 50); + var anotherPerson = new Person("Adult1", 51); + NotifyCollectionChangedAction action = default; + _source.AddOrUpdate(person); + + using (_collection + .ObserveCollectionChanges() + .Select(x => x.EventArgs.Action) + .Subscribe(updateType => action = updateType)) + { + _source.AddOrUpdate(anotherPerson); + } + + action.Should().Be(NotifyCollectionChangedAction.Replace, "The notification type should be Replace"); + } + [Fact] public void RemoveSourceRemovesFromTheDestination() { diff --git a/src/DynamicData/Binding/ObservableCollectionAdaptor.cs b/src/DynamicData/Binding/ObservableCollectionAdaptor.cs index 026afc6bf..ce2d8e0e1 100644 --- a/src/DynamicData/Binding/ObservableCollectionAdaptor.cs +++ b/src/DynamicData/Binding/ObservableCollectionAdaptor.cs @@ -127,8 +127,7 @@ private void DoUpdate(IChangeSet updates, IObservableCollection