Esempio n. 1
0
 void IDependencyVisitor.Configured(ConfiguredDependency dependency)
 {
     if (dependency.Definition.Value != null)
     {
         Dependencies.Add(dependency.DependencyType, dependency.Definition.Value);
     }
     else
     {
         var child = new ObjectDefInstance(dependency.Definition);
         Dependencies.Add(dependency.DependencyType, child);
     }
 }
Esempio n. 2
0
 void IDependencyVisitor.Configured(ConfiguredDependency dependency)
 {
     if (dependency.Definition.Value != null)
     {
         Dependencies.Add(dependency.DependencyType, dependency.Definition.Value);
     }
     else
     {
         var child = new ObjectDefInstance(dependency.Definition);
         Dependencies.Add(dependency.DependencyType, child);
     }
 }
Esempio n. 3
0
 void IDependencyVisitor.Configured(ConfiguredDependency dependency)
 {
     if (dependency.Definition.Value != null)
     {
         Child(dependency.DependencyType).Is(dependency.Definition.Value);
     }
     else
     {
         var child = new ObjectDefInstance(dependency.Definition);
         Child(dependency.DependencyType).Is(child);
     }
 }
Esempio n. 4
0
 void IDependencyVisitor.Configured(ConfiguredDependency dependency)
 {
     if (dependency.Definition.Value != null)
     {
         Child(dependency.DependencyType).Is(dependency.Definition.Value);
     }
     else
     {
         var child = new ObjectDefInstance(dependency.Definition);
         Child(dependency.DependencyType).Is(child);
     }
 }
Esempio n. 5
0
        public void build_an_object_with_a_list_dependency()
        {
            var def = new ObjectDef(typeof (ClassWithSomethings));

            var listDependency = def.ListDependenciesOf<ISomething>();

            listDependency.AddType(typeof (SomethingA));
            listDependency.AddType(typeof (SomethingB));
            listDependency.AddValue(new SomethingC());

            var instance = new ObjectDefInstance(def);

            var container = new Container();
            var @object = container.GetInstance<ClassWithSomethings>(instance);

            @object.Somethings[0].ShouldBeOfType<SomethingA>();
            @object.Somethings[1].ShouldBeOfType<SomethingB>();
            @object.Somethings[2].ShouldBeOfType<SomethingC>();
        }
        private IActionBehavior behavior(DiagnosticLevel level)
        {
            var objectDef = theNode.As<IContainerModel>().ToObjectDef(level);
            var instance = new ObjectDefInstance(objectDef);

            return theContainer.GetInstance<IActionBehavior>(instance);
        }
Esempio n. 7
0
        public void make_sure_we_can_actually_build_it()
        {
            var instance = new ObjectDefInstance(endpointObjectDef);
            var container = new Container();

            container.GetInstance<IEndPointAuthorizor>(instance)
                .ShouldBeOfType<EndPointAuthorizor>()
                .Policies.Cast<AllowRole>().Select(x => x.Role)
                .ShouldHaveTheSameElementsAs("RoleA", "RoleB", "RoleC");
        }
 void IDependencyVisitor.Configured(ConfiguredDependency dependency)
 {
     var child = new ObjectDefInstance(dependency.Definition);
     Child(dependency.DependencyType).Is(child);
 }
Esempio n. 9
0
        void IDependencyVisitor.Configured(ConfiguredDependency dependency)
        {
            var child = new ObjectDefInstance(dependency.Definition);

            Child(dependency.DependencyType).Is(child);
        }
Esempio n. 10
0
        public void name_of_the_instance_comes_from_the_name_of_the_inner_object_def()
        {
            var def = new ObjectDef(typeof (FakeJsonBehavior));
            var instance = new ObjectDefInstance(def);

            instance.Name.ShouldEqual(def.Name);
        }