Exemple #1
0
        public void SetUp()
        {
            family = new PluginFamily(typeof(IService <>));
            PluginGraph.CreateRoot("something").AddFamily(family);

            configuration = new GenericFamilyConfiguration(family, PipelineGraph.BuildEmpty());
        }
Exemple #2
0
        public void Throw_exception_When_trying_to_build_an_instance_that_cannot_be_found()
        {
            var graph = PipelineGraph.BuildEmpty();

            var ex = Exception <StructureMapConfigurationException> .ShouldBeThrownBy(() => {
                var session = new BuildSession(graph);
                session.CreateInstance(typeof(IGateway), "Gateway that is not configured");
            });

            ex.Title.ShouldEqual("Could not find an Instance named 'Gateway that is not configured' for PluginType StructureMap.Testing.Widget3.IGateway");
        }
Exemple #3
0
        public void When_calling_GetInstance_if_no_default_can_be_found_throw_202()
        {
            var graph = PipelineGraph.BuildEmpty();


            var ex = Exception <StructureMapConfigurationException> .ShouldBeThrownBy(() => {
                var session = new BuildSession(graph);
                session.GetInstance(typeof(IGateway));
            });

            ex.Context.ShouldContain("There is no configuration specified for StructureMap.Testing.Widget3.IGateway");

            ex.Title.ShouldEqual("No default Instance is registered and cannot be automatically determined for type 'StructureMap.Testing.Widget3.IGateway'");
        }
Exemple #4
0
 public void create_with_explicit_levels()
 {
     new BuildPlanVisualizer(PipelineGraph.BuildEmpty(), levels: 2)
     .MaxLevels.ShouldEqual(2);
 }
Exemple #5
0
 public void create_default_is_0_levels()
 {
     new BuildPlanVisualizer(PipelineGraph.BuildEmpty())
     .MaxLevels.ShouldEqual(0);
 }
Exemple #6
0
 public void create_deep()
 {
     new BuildPlanVisualizer(PipelineGraph.BuildEmpty(), deep: true)
     .MaxLevels.ShouldEqual(int.MaxValue);
 }