Ejemplo n.º 1
0
        protected override void OnAddRangeCompleted(IEnumerable <T> addedRange)
        {
            base.OnAddRangeCompleted(addedRange);

            this.EnsureNotDisposed();
            if (!this.IsCachingSuspended && this.IsTracking)
            {
                var descriptor = new CollectionRangeDescriptor <T>(addedRange);
                var change     = new AddRangeCollectionChange <T>(this, descriptor, collectionAddRangeRejectCallback, null, string.Empty);
                this.Memento.Add(change, AddChangeBehavior.Default);
            }
        }
        public void collectionClearedDescriptor_ctor_normal_should_set_expected_values()
        {
            var items = new[]
            {
                new GenericParameterHelper(),
                new GenericParameterHelper(),
                new GenericParameterHelper()
            };

            var target = new CollectionRangeDescriptor <GenericParameterHelper>(items);

            target.Items.Should().Have.SameSequenceAs(items);
        }
		public void collectionClearedDescriptor_ctor_normal_should_set_expected_values()
		{
			var items = new[] 
			{ 
				new GenericParameterHelper(), 
				new GenericParameterHelper(), 
				new GenericParameterHelper() 
			};

			var target = new CollectionRangeDescriptor<GenericParameterHelper>( items );

			target.Items.Should().Have.SameSequenceAs( items );
		}
Ejemplo n.º 4
0
        /// <summary>
        /// Called when clear is completed.
        /// </summary>
        protected override void OnClearCompleted(IEnumerable <T> clearedItems)
        {
            base.OnClearCompleted(clearedItems);

            this.EnsureNotDisposed();

            if (clearedItems.Any() && !this.IsCachingSuspended && this.IsTracking)
            {
                var descriptor = new CollectionRangeDescriptor <T>(clearedItems);
                var change     = new CollectionClearedChange <T>(this, descriptor, collectionClearedRejectCallback, null, string.Empty);
                this.Memento.Add(change, AddChangeBehavior.Default);
            }
        }