public void RemoveRaisesPropertyChangedEventForItemIndexerAndCount()
        {
            // given
            using (var observableDictionary = new ObservableDictionary<int, string>())
            {
                observableDictionary.Add(1, "One");

                observableDictionary.MonitorEvents();

                // when
                observableDictionary.Remove(1);

                // then
                observableDictionary
                    .ShouldRaise(nameof(observableDictionary.PropertyChanged))
                    .WithSender(observableDictionary)
                    .WithArgs<PropertyChangedEventArgs>(args => args.PropertyName == "Item[]");

                observableDictionary
                    .ShouldRaise(nameof(observableDictionary.PropertyChanged))
                    .WithSender(observableDictionary)
                    .WithArgs<PropertyChangedEventArgs>(args => args.PropertyName == nameof(observableDictionary.Count));
            }
        }
        public void RemoveRangeRaisesPropertyChangedEventForItemIndexerAndCountOnlyOnceWhenThresholdAmountWhenItemChangesAreNotifiedAsResetIsSetAccordingly()
        {
            // given
            var items = new List<KeyValuePair<int, string>>()
                {
                    new KeyValuePair<int, string>(1, "One"),
                    new KeyValuePair<int, string>(2, "Two"),
                    new KeyValuePair<int, string>(3, "Three"),
                };

            using (var observableDictionary = new ObservableDictionary<int, string>(items))
            {
                observableDictionary.ThresholdAmountWhenChangesAreNotifiedAsReset = 0;
                observableDictionary.MonitorEvents();

                // when
                observableDictionary.RemoveRange(items);

                // then
                observableDictionary
                    .ShouldRaise(nameof(observableDictionary.PropertyChanged))
                    .WithSender(observableDictionary)
                    .WithArgs<PropertyChangedEventArgs>(args => args.PropertyName == "Item[]")
                    .Should().HaveCount(1); // ToDo: re-enable test if/when https://github.com/dennisdoomen/fluentassertions/issues/337 has been fixed

                observableDictionary
                    .ShouldRaise(nameof(observableDictionary.PropertyChanged))
                    .WithSender(observableDictionary)
                    .WithArgs<PropertyChangedEventArgs>(args => args.PropertyName == nameof(observableDictionary.Count))
                    .Should().HaveCount(1); // ToDo: re-enable test if/when https://github.com/dennisdoomen/fluentassertions/issues/337 has been fixed
            }
        }
        public void RemoveRangeRaisesPropertyChangedEventForItemIndexerAndCount()
        {
            // given
            var items = new List<KeyValuePair<int, string>>()
                {
                    new KeyValuePair<int, string>(1, "One"),
                    new KeyValuePair<int, string>(2, "Two"),
                    new KeyValuePair<int, string>(3, "Three"),
                };

            using (var observableDictionary = new ObservableDictionary<int, string>(items))
            {
                observableDictionary.ThresholdAmountWhenChangesAreNotifiedAsReset = 0;
                observableDictionary.MonitorEvents();

                // when
                observableDictionary.RemoveRange(items);

                // then
                observableDictionary
                    .ShouldRaise(nameof(observableDictionary.PropertyChanged))
                    .WithSender(observableDictionary)
                    .WithArgs<PropertyChangedEventArgs>(args => args.PropertyName == "Item[]");

                observableDictionary
                    .ShouldRaise(nameof(observableDictionary.PropertyChanged))
                    .WithSender(observableDictionary)
                    .WithArgs<PropertyChangedEventArgs>(args => args.PropertyName == nameof(observableDictionary.Count));
            }
        }
        public void ClearDoesNotRaisesPropertyChangeEventForItemIndexerdAndCountIfDictionaryIsEmpty()
        {
            // given
            using (var observableDictionary = new ObservableDictionary<int, string>())
            {
                observableDictionary.MonitorEvents();

                // when
                observableDictionary.Clear();

                // then
                observableDictionary
                    .ShouldNotRaise(nameof(observableDictionary.PropertyChanged));
            }
        }