コード例 #1
0
ファイル: WindsorHelperTest.cs プロジェクト: pars87/Catel
        public void RegisterInstance_Valid()
        {
            var helper = new WindsorHelper();
            var instance = new TestClass1() { Name = "test" };

            var container = new WindsorContainer();
            Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface)));

            helper.RegisterInstance(container, typeof(ITestInterface), instance);
            Assert.IsTrue(container.Resolve<ITestInterface>() != null);
            Assert.AreEqual(instance, container.Resolve<ITestInterface>());
        }
コード例 #2
0
ファイル: WindsorHelperTest.cs プロジェクト: pars87/Catel
        public void RegisterInstance_InvalidContainer()
        {
            var helper = new WindsorHelper();

            var container = new object();
            ExceptionTester.CallMethodAndExpectException<NotSupportedException>(() => helper.RegisterInstance(container, typeof(ITestInterface), new TestClass1()));
        }
コード例 #3
0
ファイル: WindsorHelperTest.cs プロジェクト: pars87/Catel
        public void RegisterInstance_InterfaceTypeNull()
        {
            var helper = new WindsorHelper();

            var container = new WindsorContainer();
            ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => helper.RegisterInstance(container, null, new TestClass1()));
        }
コード例 #4
0
ファイル: WindsorHelperTest.cs プロジェクト: pars87/Catel
        public void RegisterInstance_InstanceNull()
        {
            var helper = new WindsorHelper();

            var container = new WindsorContainer();
            ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => helper.RegisterInstance(container, typeof(ITestInterface), null));
        }
コード例 #5
0
ファイル: WindsorHelperTest.cs プロジェクト: pars87/Catel
        public void RegisterInstance_ContainerNull()
        {
            var helper = new WindsorHelper();

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