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"); }
public void UpdateToSourceSendsReplaceIfSortingIsNotAffected() { var person1 = new Person("Adult1", 10); var person2 = new Person("Adult2", 11); NotifyCollectionChangedAction action = default; _source.AddOrUpdate(person1); _source.AddOrUpdate(person2); var person2Updated = new Person("Adult2", 12); using (_collection.ObserveCollectionChanges().Select(change => change.EventArgs.Action).Subscribe(act => action = act)) { _source.AddOrUpdate(person2Updated); } action.Should().Be(NotifyCollectionChangedAction.Replace, "The notification type should be Replace"); _collection.Should().Equal(person1, person2Updated); }