Example #1
0
 public void ImportInto(BehaviorGraph graph)
 {
     // TODO -- will want this to suck in the configuration log business somehow
     Registry.Compile();
     BehaviorGraph childGraph = Registry.Configuration.BuildForImport(graph);
     graph.As<IChainImporter>().Import(childGraph, b => {
         b.PrependToUrl(Prefix);
         b.Origin = Registry.Name;
     });
 }
Example #2
0
        public void ImportInto(BehaviorGraph parent, ConfigLog log)
        {
            var childGraph = BehaviorGraphBuilder.Import(Registry, parent, log);
            parent.As<IChainImporter>().Import(childGraph, b => {
                b.PrependToUrl(Prefix);
                b.Origin = Registry.Name;
            });

            log.Import(Registry.Config, Provenance);
        }
        public void SetUp()
        {
            var builder = new ContainerBuilder();
            builder.RegisterType<FileSystem>().As<IFileSystem>();
            builder.RegisterInstance(MockRepository.GenerateMock<IStreamingData>()).As<IStreamingData>();
            builder.RegisterInstance(new NulloHttpWriter()).As<IHttpWriter>();
            builder.RegisterInstance(new CurrentChain(null, null)).As<ICurrentChain>();
            builder.RegisterInstance(
                new StandInCurrentHttpRequest
                {
                    ApplicationRoot = "http://server"
                }).As<ICurrentHttpRequest>();
            builder.RegisterInstance(MockRepository.GenerateMock<IResourceHash>()).As<IResourceHash>();
            builder.RegisterType<AutofacContainerFacility>().As<IContainerFacility>();
            context = builder.Build();

            graph = BehaviorGraph.BuildFrom(
                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()));
                });

            facility = new AutofacContainerFacility(context);
            graph.As<IRegisterable>().Register(facility.Register);

            factory = facility.BuildFactory();
        }
        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);
        }
Example #5
0
        public void SetUp()
        {
            registry1 = new FubuRegistry();
            registry1.Actions.IncludeType<RegistryImportEndpoint>();

            theImport = new RegistryImport
            {
                Prefix = "area1",
                Registry = registry1
            };

            graph2 = BehaviorGraph.BuildFrom(x => {
                x.Actions.IncludeType<TestController>();
            });

            graph2.As<IChainImporter>().Import(theImport.BuildChains(graph2.Settings));
        }
        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();
        }
        public void SetUp()
        {
            container = new Container(x =>
            {
                x.For<IFileSystem>().Use<FileSystem>();
                x.For<IHttpResponse>().Use(new OwinHttpResponse());
                x.For<ICurrentChain>().Use(new CurrentChain(null, null));
                x.For<IHttpRequest>().Use(OwinHttpRequest.ForTesting());

                x.For<IResourceHash>().Use(MockRepository.GenerateMock<IResourceHash>());
            });

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

            graph = BehaviorGraph.BuildFrom(x => {
                x.Actions.IncludeType<TestController>();

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

                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()));
            });

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

            factory = facility.BuildFactory();
        }