public void CanFindObjectsByAssignableType() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); collection.Add("Hello world"); Assert.AreEqual(1, collection.FindByType(typeof(string)).Count); Assert.AreEqual(1, collection.FindByType(typeof(object)).Count); Assert.AreEqual(0, collection.FindByType(typeof(int)).Count); }
public void CanFindObjectsByAssignableType_Generic() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); collection.Add("Hello world"); Assert.AreEqual(1, collection.FindByType <string>().Count); Assert.AreEqual(1, collection.FindByType <object>().Count); Assert.AreEqual(0, collection.FindByType <int>().Count); }