コード例 #1
0
ファイル: UnityHelperTest.cs プロジェクト: pars87/Catel
        public void GetRegistrationInfo_ContainerWithoutTypeRegistered()
        {
            var helper = new UnityHelper();

            var container = new UnityContainer();
            Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface)));
        }
コード例 #2
0
ファイル: UnityHelperTest.cs プロジェクト: pars87/Catel
        public void GetRegistrationInfo_InterfaceTypeNull()
        {
            var helper = new UnityHelper();

            var container = new UnityContainer();
            ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => helper.GetRegistrationInfo(container, null));
        }
コード例 #3
0
ファイル: UnityHelperTest.cs プロジェクト: pars87/Catel
        public void GetRegistrationInfo_InvalidContainer()
        {
            var helper = new UnityHelper();

            var container = new object();
            ExceptionTester.CallMethodAndExpectException<NotSupportedException>(() => helper.GetRegistrationInfo(container, typeof(ITestInterface)));
        }
コード例 #4
0
ファイル: UnityHelperTest.cs プロジェクト: pars87/Catel
        public void GetRegistrationInfo_ContainerWithTransientTypeRegistered()
        {
            var helper = new UnityHelper();

            var container = new UnityContainer();
            container.RegisterType<ITestInterface, TestClass1>(new TransientLifetimeManager());

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

            Assert.AreEqual(typeof(ITestInterface), registrationInfo.DeclaringType);
            Assert.AreEqual(RegistrationType.Transient, registrationInfo.RegistrationType);
        }
コード例 #5
0
ファイル: UnityHelperTest.cs プロジェクト: pars87/Catel
        public void GetRegistrationInfo_ContainerNull()
        {
            var helper = new UnityHelper();

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