public void Remove()
        {
            var collection = new InstanceCollectionInt32Cached <Instance>();
            var instance   = new Instance();
            int id         = collection.Add(instance);

            Assert.IsTrue(collection.Contains(id), "collection.Contains(id)");

            bool removeResult = collection.Remove(id);

            Assert.IsTrue(removeResult, "removeResult");
            Assert.AreEqual(1, collection.CacheCount);

            int id2 = collection.Add(instance);

            Assert.AreEqual(0, collection.CacheCount);
            Assert.AreEqual(id2, id);
        }
        public void Clear()
        {
            var collection = new InstanceCollectionInt32Cached <Instance>();
            var instance   = new Instance();

            int id = collection.Add(instance);

            Assert.AreEqual(1, collection.Count);
            Assert.AreEqual(id, collection.Generator.PreviousIdentifier);

            collection.Clear();
            collection.Generator.Reset();

            Assert.AreEqual(0, collection.Count);
            Assert.AreEqual(0, collection.CacheCount);
            Assert.AreEqual(collection.Generator.PreviousIdentifier, collection.Generator.DefaultIdentifier);

            int id2 = collection.Add(instance);

            Assert.AreEqual(id2, id);
        }