Exemple #1
0
        public void ExpressionExport_InjectionContext()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.Export <BasicService>().As <IBasicService>();
                c.ExportExpression(() =>
                                   new InjectionContextClass(Arg.Locate <IBasicService>(), Arg.Context().GetExtraData <int>("somevalue")));
            });

            var instance = container.Locate <InjectionContextClass>(new { SomeValue = 10 });

            Assert.NotNull(instance);
            Assert.Equal(10, instance.SomeValue);
        }