Exemple #1
0
        public void shoule_get_instance_with_inline_dependencies()
        {
            ArrayInstance <string> instance = new ArrayInstance <string>(typeof(string[]));

            instance.AddInline(new ObjectInstance(typeof(string), "a"));
            instance.AddInline(new ObjectInstance(typeof(string), "b"));

            ConstructorInstance @object = new ConstructorInstance(typeof(ITestInstance), typeof(TestInstance), ServiceLifetime.Transient);

            @object.AddInline(instance);

            IContainer container = new Container(p =>
            {
                p.For <ITestInstance>().Use(@object);
            });


            ITestInstance value = container.GetInstance <ITestInstance>();

            value.Data.ShouldHaveTheSameElementsAs(new string[] { "a", "b" });
        }