public void ParametersCanBePassedInStringForm() { IReflectionContainerAdapter reflectionFrontEnd = new DefaultReflectionContainerAdapter(); string className = typeof (ThingThatTakesParamsInConstructor).FullName; reflectionFrontEnd.RegisterComponentImplementation( "thing", className, new string[] { "System.String", "System.Int32", typeof (bool).FullName }, new string[] { "hello", "22", "true" } ); ThingThatTakesParamsInConstructor thing = (ThingThatTakesParamsInConstructor) reflectionFrontEnd.PicoContainer.GetComponentInstance("thing"); Assert.IsNotNull(thing); Assert.AreEqual("hello22" + bool.TrueString, thing.Value); }
public void Provision() { IReflectionContainerAdapter reflectionFrontEnd = new DefaultReflectionContainerAdapter(); reflectionFrontEnd.RegisterComponentImplementation("NanoContainer.Test.TestModel.DefaultWebServerConfig"); reflectionFrontEnd.RegisterComponentImplementation("NanoContainer.Test.TestModel.DefaultWebServer"); Assert.IsNotNull(reflectionFrontEnd.PicoContainer.GetComponentInstance(typeof (DefaultWebServer))); Assert.IsTrue(reflectionFrontEnd.PicoContainer.GetComponentInstance(typeof (DefaultWebServer)) is DefaultWebServer); }
public DefaultNanoContainer(StreamReader composition, String builderClass) { DefaultReflectionContainerAdapter defaultReflectionContainerAdapter; DefaultPicoContainer dpc = new DefaultPicoContainer(); dpc.RegisterComponentInstance(composition); defaultReflectionContainerAdapter = new DefaultReflectionContainerAdapter(dpc); IComponentAdapter componentAdapter = defaultReflectionContainerAdapter.RegisterComponentImplementation(builderClass); containerBuilder = (ScriptedContainerBuilder) componentAdapter.GetComponentInstance(dpc); }
public void NoGenerationRegistration() { IReflectionContainerAdapter reflectionFrontEnd = new DefaultReflectionContainerAdapter(); reflectionFrontEnd.RegisterComponentImplementation("Ping"); }
public void Basic() { IReflectionContainerAdapter reflectionFrontEnd = new DefaultReflectionContainerAdapter(); reflectionFrontEnd.RegisterComponentImplementation("NanoContainer.Test.TestModel.DefaultWebServerConfig"); reflectionFrontEnd.RegisterComponentImplementation("NanoContainer.Test.TestModel.WebServer", "NanoContainer.Test.TestModel.DefaultWebServer"); }