예제 #1
0
        public void GetRegistrationInfo_ContainerWithoutTypeRegistered()
        {
            var helper = new NinjectHelper();

            var container = new StandardKernel();

            Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface)));
        }
예제 #2
0
        public void GetRegistrationInfo_ContainerWithSingletonTypeRegistered()
        {
            var helper = new NinjectHelper();

            var container = new StandardKernel();

            container.Bind <ITestInterface>().To <TestClass1>().InSingletonScope();

            var registrationInfo = helper.GetRegistrationInfo(container, typeof(ITestInterface));

            Assert.AreEqual(typeof(ITestInterface), registrationInfo.DeclaringType);
            Assert.AreEqual(RegistrationType.Singleton, registrationInfo.RegistrationType);
        }
예제 #3
0
        public void GetRegistrationInfo_InterfaceTypeNull()
        {
            var helper = new NinjectHelper();

            var container = new StandardKernel();

            ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.GetRegistrationInfo(container, null));
        }
예제 #4
0
        public void GetRegistrationInfo_InvalidContainer()
        {
            var helper = new NinjectHelper();

            var container = new object();

            ExceptionTester.CallMethodAndExpectException <NotSupportedException>(() => helper.GetRegistrationInfo(container, typeof(ITestInterface)));
        }
예제 #5
0
        public void GetRegistrationInfo_ContainerNull()
        {
            var helper = new NinjectHelper();

            ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.GetRegistrationInfo(null, typeof(ITestInterface)));
        }