public void Ensure_Multiple_Instance_Registration_Working()
        {
            var regs = new StashboxContainer()
                       .RegisterInstances <ITest>(new Test(), new Test1()).GetRegistrationMappings();

            Assert.Equal(2, regs.Count());
        }
Ejemplo n.º 2
0
        public void ContainerTests_Configuration_DuplicatedBehavior_Preserve()
        {
            var regs = new StashboxContainer(c =>
                                             c.WithRegistrationBehavior(Rules.RegistrationBehavior.PreserveDuplications))
                       .Register <Test1>().Register <Test1>().GetRegistrationDiagnostics();

            Assert.Equal(2, regs.Count());
        }
Ejemplo n.º 3
0
        public void GenericTests_Resolve_Prefer_Valid_Constraint_In_Named_Scope_Enumerable()
        {
            var inst = new StashboxContainer()
                       .RegisterType(typeof(IConstraintTest <>), typeof(ConstraintTest3 <>), config => config.InNamedScope("A"))
                       .RegisterType(typeof(IConstraintTest <>), typeof(ConstraintTest2 <>), config => config.InNamedScope("A"))
                       .BeginScope("A")
                       .ResolveAll <IConstraintTest <ConstraintArgument1> >();

            Assert.AreEqual(1, inst.Count());
        }