public void RemoveFromCollection(ICollectableBase collectableToRemove)
 {
     try
     {
         _homeCollection.RemoveFromCollection(collectableToRemove);
     }
     catch (Exception ex)
     {
         throw new CollectionException("Error removing item from collection", ex);
     }
 }
Exemplo n.º 2
0
        public void removefromcollection_deletes_collectable_from_collection()
        {
            int N = 3;

            foreach (Type collectableType in CollectableBaseFactory.CollectableTypes)
            {
                ICollectionBase  testCollection      = GetMockCollection(N, collectableType);
                ICollectableBase collectableToRemove = testCollection.Collectables[0]; //[N - 1];

                testCollection.RemoveFromCollection(collectableToRemove);

                bool foundCollectable = false;
                foreach (ICollectableBase collectable in testCollection.Collectables)
                {
                    if (collectableToRemove == collectable)
                    {
                        foundCollectable = true;
                        break;
                    }
                }
                Assert.IsFalse(foundCollectable);
            }
        }