Esempio n. 1
0
        public void Container_Instance_ShouldNotChange()
        {
            IInterface_1 instance = new Implementation_1_No_Dep();

            Container.Instance(instance);

            Assert.AreSame(instance, Container.CreateChild().Get <IInterface_1>(QueryModes.ThrowOnError).Instances.Single().Value);
        }
Esempio n. 2
0
        public void Injector_Instantiate_ShouldAcceptExplicitArguments()
        {
            var dep = new Implementation_1_No_Dep();

            using (IInjector injector = Container.CreateInjector())
            {
                Implementation_2_IInterface_1_Dependant obj = injector.Instantiate <Implementation_2_IInterface_1_Dependant>(new Dictionary <string, object>
                {
                    { "interface1", dep }
                });

                Assert.That(obj.Interface1, Is.SameAs(dep));
            }
        }