Example #1
0
 public void ShifterAddType_AdditionOfAbstractClassAsTypeToBeResolved_AnExceptionIsThrown()
 {
     var shifter       = new ShifterContainer();
     var resolvedClass = shifter
                         .AddType(typeof(IResolveTest), typeof(AbstractClass))
                         .Resolve <ResolveTestClass>();
 }
Example #2
0
        public void ShifterAddType_AdditionOfTypeWithDefaultConstructor_TheTypeIsResolved()
        {
            var shifter       = new ShifterContainer();
            var resolvedClass = shifter
                                .AddType(typeof(IResolveTest), typeof(DefaultConstructorResolveTest))
                                .Resolve <IResolveTest>();

            Assert.IsNotNull(resolvedClass);
            Assert.IsInstanceOfType(resolvedClass, typeof(DefaultConstructorResolveTest));
        }
Example #3
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);
        }
Example #4
0
        public void ShifterAddType_SecondParameterIsNull_AnExceptionIsThrown()
        {
            var shifter = new ShifterContainer();

            shifter.AddType(typeof(IShifterContainer), null);
        }
Example #5
0
        public void ShifterAddType_FirstParameterIsNull_AnExceptionIsThrown()
        {
            var shifter = new ShifterContainer();

            shifter.AddType(null, typeof(string));
        }