public void ObjectNamesForTypeIncludingAncestorsPrototypesAndFactoryObjectsPreserveOrderOfRegistration() { IList <string> names = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(_factory, _expectedtype, false, false); Assert.AreEqual(5, names.Count); Assert.AreEqual(new string[] { "objA", "objB", "objC", "obj2A", "obj2C" }, names); }
public void ObjectNamesForTypeIncludingAncestors() { IList <string> names = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(_factory, typeof(ITestObject)); // includes 2 TestObjects from IFactoryObjects (DummyFactory definitions) Assert.AreEqual(4, names.Count); Assert.IsTrue(names.Contains("test")); Assert.IsTrue(names.Contains("test3")); Assert.IsTrue(names.Contains("testFactory1")); Assert.IsTrue(names.Contains("testFactory2")); }
public void ObjectNamesForTypeIncludingAncestorsExcludesObjectsFromParentWhenLocalObjectDefined() { DefaultListableObjectFactory root = new DefaultListableObjectFactory(); root.RegisterObjectDefinition("excludeLocalObject", new RootObjectDefinition(typeof(ArrayList))); DefaultListableObjectFactory child = new DefaultListableObjectFactory(root); child.RegisterObjectDefinition("excludeLocalObject", new RootObjectDefinition(typeof(Hashtable))); IList <string> names = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(child, typeof(ArrayList)); // "excludeLocalObject" matches on the parent, but not the local object definition Assert.AreEqual(0, names.Count); names = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(child, typeof(ArrayList), true, true); // "excludeLocalObject" matches on the parent, but not the local object definition Assert.AreEqual(0, names.Count); }