コード例 #1
0
        public void SetUp()
        {
            graph1 = new FubuRegistry(x =>
            {
                x.Route("method1/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("method2/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("method3/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();
            }).BuildGraph();

            chain = new BehaviorChain();
            graph1.AddChain(chain);

            graph2 = new FubuRegistry(x =>
            {
                x.Route("/root/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();
            }).BuildGraph();

            graph2.As <IChainImporter>().Import(graph1, b => b.PrependToUrl("area1"));
        }
コード例 #2
0
        public void SetUp()
        {
            container = new Container(x => x.For <IFileSystem>().Use <FileSystem>());


            graph = new FubuRegistry(x =>
            {
                x.Route("/area/sub/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub2/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub3/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Models.ConvertUsing <ExampleConverter>().ConvertUsing <ExampleConverter2>();


                x.Services(s => s.AddService <IActivator>(new StubActivator()));
                x.Services(s => s.AddService <IActivator>(new StubActivator()));
                x.Services(s => s.AddService <IActivator>(new StubActivator()));
            }).BuildGraph();

            facility = new StructureMapContainerFacility(container);
            graph.As <IRegisterable>().Register(facility.Register);

            factory = facility.BuildFactory(DiagnosticLevel.None);
        }
コード例 #3
0
        public void SetUp()
        {
            container = new Container(x =>
            {
                x.For <IFileSystem>().Use <FileSystem>();
                x.For <IStreamingData>().Use(MockRepository.GenerateMock <IStreamingData>());
                x.For <IHttpWriter>().Use(new NulloHttpWriter());
                x.For <ICurrentChain>().Use(new CurrentChain(null, null));
                x.For <ICurrentHttpRequest>().Use(new StubCurrentHttpRequest("http://server"));
            });

            container.Configure(x => x.For <IContainerFacility>().Use <StructureMapContainerFacility>());


            graph = new FubuRegistry(x =>
            {
                x.Route("/area/sub/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub2/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub3/{Name}/{Age}")
                .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Models.ConvertUsing <ExampleConverter>().ConvertUsing <ExampleConverter2>();


                x.Services(s => s.AddService <IActivator>(new StubActivator()));
                x.Services(s => s.AddService <IActivator>(new StubActivator()));
                x.Services(s => s.AddService <IActivator>(new StubActivator()));
            }).BuildGraph();

            facility = new StructureMapContainerFacility(container);
            graph.As <IRegisterable>().Register(DiagnosticLevel.None, facility.Register);

            factory = facility.BuildFactory();
        }