Example #1
0
        public void TestResolveToNamespaceTransient()
        {
            var container = new InjectionContainer();

            container.Bind <IMockInterface>().ToNamespace("Adic.Tests");
            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);
        }
Example #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);
        }
Example #3
0
        public void TestResolveToNamespaceTransient()
        {
            var container = new InjectionContainer();

            container.Bind<IMockInterface>().ToNamespace("Adic.Tests");
            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);
        }
Example #4
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);
        }