Ejemplo n.º 1
0
        public ShifterContext(Type typeToResolve, IShifterContainer container, IEnumerable <Func <IResolutionStrategy> > strategyFactoryFactories)
        {
            Assume.ArgumentNotNull(typeToResolve, "typeToResolve");
            Assume.ArgumentNotNull(container, "container");
            Assume.ArgumentNotNull(strategyFactoryFactories, "strategyFactoryFactories");

            TypeToResolve     = typeToResolve;
            Container         = container;
            StrategyFactories = strategyFactoryFactories;
        }
Ejemplo n.º 2
0
        public void ShifterAddInstance_AddInstanceReturnsShiftContainer_TheShiftContainerIsReturned()
        {
            var shifter = new ShifterContainer();
            IShifterContainer container = shifter.AddInstance(new object());

            Assert.AreSame(shifter, container);

            container = shifter.AddInstance <IResolveTest>(new ImplementsResolveTest());

            Assert.AreSame(shifter, container);

            container = shifter.AddInstance(typeof(ResolveTestClass), new ResolveTestClass());

            Assert.AreSame(shifter, container);

            container = shifter.AddType(typeof(IComparable), typeof(String));

            Assert.AreSame(shifter, container);

            container = shifter.AddType <IResolveTest2, ImplementsResolveTest2>();

            Assert.AreSame(shifter, container);
        }