public void ShouldAllowConfigurationClassInheritance() { var factory = new DefaultListableObjectFactory(); factory.RegisterObjectDefinition("DerivedConfiguration", new GenericObjectDefinition { ObjectType = typeof(DerivedConfiguration) }); var processor = new ConfigurationClassPostProcessor(); processor.PostProcessObjectFactory(factory); // we should get singleton instances only TestObject testObject = (TestObject) factory.GetObject("DerivedDefinition"); string singletonParent = (string) factory.GetObject("BaseDefinition"); Assert.That(testObject.Value, Is.SameAs(singletonParent)); }
public void ShouldAllowConfigurationClassInheritance() { var factory = new DefaultListableObjectFactory(); factory.RegisterObjectDefinition("DerivedConfiguration", new GenericObjectDefinition { ObjectType = typeof(DerivedConfiguration) }); var processor = new ConfigurationClassPostProcessor(); processor.PostProcessObjectFactory(factory); // we should get singleton instances only TestObject testObject = (TestObject)factory.GetObject("DerivedDefinition"); string singletonParent = (string)factory.GetObject("BaseDefinition"); Assert.That(testObject.Value, Is.SameAs(singletonParent)); }