示例#1
0
        public void GetRegistrationInfo_ContainerWithoutTypeRegistered()
        {
            var helper = new MefHelper();

            var container = new CompositionContainer();

            Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface)));
        }
示例#2
0
        public void GetRegistrationInfo_ContainerWithSingletonTypeRegistered()
        {
            var helper = new MefHelper();

            var container = new CompositionContainer();

            container.RegisterType(typeof(ITestInterface), typeof(TestClass1));

            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 MefHelper();

            var container = new CompositionContainer();

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

            var container = new object();

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

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