public void Factory3() { IComponentFactory1 factory = (IComponentFactory1)_container["compFactory1"]; Assert.IsNotNull(factory); IDummyComponent comp1 = factory.Construct(); Assert.IsNotNull(comp1); IDummyComponent comp2 = factory.Construct(); Assert.IsNotNull(comp2); }
public void Factory3() { _facility.AddTypedFactoryEntry( new FactoryEntry( "compFactory", typeof(IComponentFactory1), "Construct", "")); _container.AddComponent("comp1", typeof(IDummyComponent), typeof(Component1)); _container.AddComponent("comp2", typeof(IDummyComponent), typeof(Component2)); IComponentFactory1 factory = (IComponentFactory1)_container["compFactory"]; Assert.IsNotNull(factory); IDummyComponent comp1 = factory.Construct(); Assert.IsNotNull(comp1); IDummyComponent comp2 = factory.Construct(); Assert.IsNotNull(comp2); }