Esempio n. 1
0
        public void Injected_Registered_Instance_To_DependencyInjector()
        {
            NonServiceTest nonServiceTestClass = new NonServiceTest();

            injector.RegisterInstance <NonServiceTest>(nonServiceTestClass);

            InjectionTestRegisteredObject test = new InjectionTestRegisteredObject();

            injector.InjectMethod(test);

            Assert.IsNotNull(test.dependency);
            Assert.IsInstanceOf <NonServiceTest>(test.dependency);
        }
Esempio n. 2
0
        public void Unregistered_Instance_From_DependencyInjector()
        {
            NonServiceTest nonServiceTest = new NonServiceTest();

            injector.RegisterInstance <NonServiceTest>(nonServiceTest);

            nonServiceTest = null;
            injector.UnRegisterInstance <NonServiceTest>();

            InjectionTestRegisteredObject test = new InjectionTestRegisteredObject();

            injector.InjectMethod(test);

            Assert.IsNull(test.dependency);
        }