public void ShouldResolveAllInterfaces()
    {
        var builder = new UnityObjectBuilder();


        builder.Configure(typeof(First), DependencyLifecycle.InstancePerCall);

        builder.Configure(typeof(Second), DependencyLifecycle.InstancePerCall);

        var result = builder.BuildAll(typeof(ISomeInterface));

        Assert.AreEqual(2, result.Count());
    }
示例#2
0
        public void Existing_registrations_are_not_registered_twice()
        {
            var container = new UnityContainer();

            container.RegisterType <ISomeInterface, NamedService1>("1");
            container.RegisterType <ISomeInterface, NamedService2>("2");
            container.RegisterType <ISomeInterface, NamedService3>("3");

            var builder = new UnityObjectBuilder(container);

            var result = builder.BuildAll(typeof(ISomeInterface));

            Assert.AreEqual(3, result.Count());
        }