public void BuildWithCustomProfileAndAvalonComponentConfiguration()
        {
            String contents =
                "<container>" +
                "  <components baseAssembly=\"Apache.Avalon.Castle.Windsor.Test, Version=1.0.0.0\">" +
                "    <component lifestyle=\"singleton\" key=\"mail\" service=\"Apache.Avalon.Castle.Windsor.Test.Component.Avalon.IMailServer\" " +
                "               implementation=\"Apache.Avalon.Castle.Windsor.Test.Component.Avalon.MailServer2\">  " +
                "      <configuration>" +
                "        <port>1001</port>" +
                "        <server>mailserver</server>" +
                "      </configuration>" +
                "    </component>" +
                "  </components>" +
                "</container>";

            IContainerProfile profile = new XmlProfileBuilder().Build(contents);
            ContainerBuilder builder = new ContainerBuilder();

            IContainer container = builder.Build( profile );

            IMailServer mailServer = (IMailServer) container.Resolve( typeof(IMailServer) );
            AssertNotNull( mailServer );
            AssertEquals( 1001, mailServer.Port );
            AssertEquals( "mailserver", mailServer.Server );
        }
        public void Build()
        {
            ContainerBuilder builder = new ContainerBuilder();
            IContainer container = builder.Build();

            AssertNotNull(container);
            AssertNotNull(container.MicroKernel);
            AssertNull(container.Parent);
        }
        public void BuildWithInstanceTracker()
        {
            ContainerBuilder builder = new ContainerBuilder( new InstanceHandlerTracker() );
            IContainer container = builder.Build();

            AssertNotNull(container);
            AssertNotNull(container.MicroKernel);
            AssertNull(container.Parent);
        }
        public void BuildWithCustomProfileAndOverridedComponentSettings()
        {
            String contents =
                "<container>" +
                "  <components baseAssembly=\"Apache.Avalon.Castle.Windsor.Test, Version=1.0.0.0\">" +
                "    <component lifestyle=\"singleton\" key=\"a\" service=\"Apache.Avalon.Castle.Windsor.Test.Component.Simple.IService\" " +
                "               implementation=\"Apache.Avalon.Castle.Windsor.Test.Component.Simple.DefaultService\">  " +
                "      <configuration>" +
                "      </configuration>" +
                "    </component>" +
                "  </components>" +
                "</container>";

            IContainerProfile profile = new XmlProfileBuilder().Build(contents);
            ContainerBuilder builder = new ContainerBuilder();

            IContainer container = builder.Build( profile );

            IService service1 = (IService) container.Resolve( typeof(IService) );
            IService service2 = (IService) container.Resolve( typeof(IService) );

            AssertNotNull( service1 );
            AssertNotNull( service2 );
            Assert( Object.ReferenceEquals(service1, service2) );
        }