public void Factory1() { IProtocolHandlerFactory1 factory = (IProtocolHandlerFactory1)_container["protocolFac1"]; Assert.IsNotNull(factory); IProtocolHandler handler = factory.Create(); Assert.IsNotNull(handler); factory.Release(handler); }
public void Factory1() { _facility.AddTypedFactoryEntry( new FactoryEntry( "protocolHandlerFactory", typeof(IProtocolHandlerFactory1), "Create", "Release")); _container.AddComponent("miranda", typeof(IProtocolHandler), typeof(MirandaProtocolHandler)); _container.AddComponent("messenger", typeof(IProtocolHandler), typeof(MessengerProtocolHandler)); IProtocolHandlerFactory1 factory = (IProtocolHandlerFactory1)_container["protocolHandlerFactory"]; Assert.IsNotNull(factory); IProtocolHandler handler = factory.Create(); Assert.IsNotNull(handler); factory.Release(handler); }