예제 #1
0
        public void TestResolveToNamespaceSingleton()
        {
            var container = new InjectionContainer();

            container.Bind <IMockInterface>().ToNamespaceSingleton("Adic.Tests");
            var bindings = container.GetBindingsFor <IMockInterface>();
            var instance = container.ResolveAll <IMockInterface>();

            Assert.AreEqual(3, instance.Length);
            Assert.IsTrue(instance[0] is MockIClass);
            Assert.IsTrue(instance[1] is MockIClassWithoutAttributes);
            Assert.IsTrue(instance[2] is MockIClassWithAttributes);
            Assert.IsTrue(instance[0] == bindings[0].value);
            Assert.IsTrue(instance[1] == bindings[1].value);
            Assert.IsTrue(instance[2] == bindings[2].value);
        }
예제 #2
0
        public void TestResolveToNamespaceSingleton()
        {
            var container = new InjectionContainer();

            container.Bind<IMockInterface>().ToNamespaceSingleton("Adic.Tests");
            var bindings = container.GetBindingsFor<IMockInterface>();
            var instance = container.ResolveAll<IMockInterface>();

            Assert.AreEqual(3, instance.Length);
            Assert.IsTrue(instance[0] is MockIClass);
            Assert.IsTrue(instance[1] is MockIClassWithoutAttributes);
            Assert.IsTrue(instance[2] is MockIClassWithAttributes);
            Assert.IsTrue(instance[0] == bindings[0].value);
            Assert.IsTrue(instance[1] == bindings[1].value);
            Assert.IsTrue(instance[2] == bindings[2].value);
        }