public void CannotRemoveTest() { // if the size of the collection is fixed, we are not allowed to add items to it. FixedSizeCollection <TestClass> fixedSizeCollection = new FixedSizeCollection <TestClass>(); PagedCollectionView pcv = new PagedCollectionView(fixedSizeCollection); Assert.IsFalse(pcv.CanRemove); }
public void CannotAddNewTest() { // if the size of the collection is fixed, we are not allowed to add items to it. FixedSizeCollection <TestClass> fixedSizeCollection = new FixedSizeCollection <TestClass>(); PagedCollectionView pcv1 = new PagedCollectionView(fixedSizeCollection); Assert.IsFalse(pcv1.CanAddNew); // if the item type does not have a constructor, we are not allowed to call AddNew. List <int> intList = new List <int>(); PagedCollectionView pcv2 = new PagedCollectionView(intList); Assert.IsFalse(pcv2.CanAddNew); PagedCollectionViewTest.AssertExpectedException( new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, PagedCollectionViewResources.OperationNotAllowedForView, "AddNew")), delegate { pcv2.AddNew(); }); }