public void Should_properly_order_dependencies_not_including_existing_ones()
        {
            var convention = new ConcreteTypeRegistrationConvention();

            var testContainer = new TestContainer(typeof(Sibling));

            RegistrationCatalog catalog = new ContainerRegistrationCatalog(convention, testContainer);

            catalog.GetRegistration(typeof(Parent));

            RegistrationFactory[] dependencies = catalog.Registrations.ToArray();

            Assert.AreEqual(
                new[] {typeof(GrandChild), typeof(Child), typeof(GrandParent), typeof(Parent)},
                dependencies.Select(x => x.RegistrationType));
        }
        public Container Build()
        {
            RegistrationConvention convention;
            if (_registrationConventions.Count == 0)
                convention = new ConcreteTypeRegistrationConvention();
            else if (_registrationConventions.Count == 1)
                convention = _registrationConventions[0];
            else
                convention = new MultipleRegistrationConvention(_registrationConventions);

            var serviceBookContainer = new ServiceBookContainer(convention);

            RegistrationCatalog catalog = new ContainerRegistrationCatalog(convention, serviceBookContainer);

            return serviceBookContainer;
        }
        public void Should_use_the_provider_factory()
        {
            var testContainer = new TestContainer();

            var convention = new ConcreteTypeRegistrationConvention();

            RegistrationCatalog catalog = new ContainerRegistrationCatalog(convention, testContainer);

            var factory = new ConstructorFactory<ISomething>(() => new Something());

            Registration registration = new ClosedTypeRegistration<ISomething>(factory);

            var registrationFactory = new ClosedTypeRegistrationFactory<ISomething>(() => factory);

            catalog.AddRegistration(registrationFactory);

            RegistrationFactory[] dependencies = catalog.Registrations.ToArray();

            Assert.AreEqual(new[] {typeof(ISomething)}, dependencies.Select(x => x.RegistrationType));
        }