コード例 #1
0
        public void RegisterType_Valid()
        {
            var helper = new WindsorHelper();

            var container = new WindsorContainer();

            Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface)));

            helper.RegisterType(container, typeof(ITestInterface), typeof(TestClass1), RegistrationType.Singleton);
            Assert.IsTrue(container.Resolve <ITestInterface>() != null);
        }
コード例 #2
0
        public void RegisterType_ImplementingTypeNull()
        {
            var helper = new WindsorHelper();

            var container = new WindsorContainer();

            ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.RegisterType(container, typeof(ITestInterface), null, RegistrationType.Singleton));
        }
コード例 #3
0
        public void RegisterType_InvalidContainer()
        {
            var helper = new WindsorHelper();

            var container = new object();

            ExceptionTester.CallMethodAndExpectException <NotSupportedException>(() => helper.RegisterType(container, typeof(ITestInterface), typeof(TestClass1), RegistrationType.Singleton));
        }
コード例 #4
0
        public void RegisterType_ContainerNull()
        {
            var helper = new WindsorHelper();

            ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.RegisterType(null, typeof(ITestInterface), typeof(TestClass1), RegistrationType.Singleton));
        }