示例#1
0
        public void Flow_Builder_Is_Hydrated_And_Flow_Built_From_Json_Serializer()
        {
            Json.Registrar.RegisterAsDefault();

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterBanzaiNodes(GetType().Assembly, true);

            var container   = containerBuilder.Build();
            var factory     = container.Resolve <INodeFactory <object> >();
            var flowBuilder = new FlowBuilder <object>(new AutofacFlowRegistrar(containerBuilder));

            flowBuilder.CreateFlow("TestFlow1")
            .AddRoot <IPipelineNode <object> >()
            .AddChild <ITestNode2>();

            var serialized = flowBuilder.SerializeRootComponent();

            Console.WriteLine(serialized);


            var component = flowBuilder.DeserializeAndSetRootComponent(serialized);

            var flow = factory.BuildFlow(component);

            flow.FlowId.Should().Be("TestFlow1");
            flow.Id.Should().Be("Banzai.Autofac.Test.TestPipelineNode1");
            ((IMultiNode <object>)flow).Children[0].Id.Should().Be("Banzai.Autofac.Test.TestNode2");
        }
示例#2
0
        public void Flow_Builder_Is_Hydrated_And_Flow_Built_From_Json_Serializer()
        {
            Registrar.RegisterAsDefault();

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterBanzaiNodes(GetType().Assembly, true);

            var container = containerBuilder.Build();

            var factory = container.Resolve <INodeFactory <object> >();

            var flowBuilder = new FlowBuilder <object>(new AutofacFlowRegistrar(containerBuilder));

            flowBuilder.CreateFlow("TestFlow1")
            .AddRoot <IPipelineNode <object> >()
            .AddChild <ITestNode2>();

            var serialized = flowBuilder.SerializeRootComponent();

            var component = flowBuilder.DeserializeAndSetRootComponent(serialized);

            var flow = factory.BuildFlow(component);

            flow.Should().NotBeNull();
        }
        public void Flow_Builder_Is_Hydrated_And_Flow_Built_From_Json_Serializer()
        {
            Json.Registrar.RegisterAsDefault();

            var kernel = new StandardKernel();

            kernel.RegisterBanzaiNodes(GetType().Assembly, true);

            var flowBuilder = new FlowBuilder <object>(new NinjectFlowRegistrar(kernel));

            flowBuilder.CreateFlow("TestFlow1")
            .AddRoot <IPipelineNode <object> >()
            .AddChild <ITestNode2>();

            var factory = kernel.Get <INodeFactory <object> >();

            var serialized = flowBuilder.SerializeRootComponent();

            Console.WriteLine(serialized);

            var component = flowBuilder.DeserializeAndSetRootComponent(serialized);

            var flow = factory.BuildFlow(component);

            flow.FlowId.ShouldEqual("TestFlow1");
            flow.Id.ShouldEqual("Banzai.Ninject.Test.TestPipelineNode1");
            ((IMultiNode <object>)flow).Children[0].Id.ShouldEqual("Banzai.Ninject.Test.TestNode2");
        }
示例#4
0
        public void Flow_Builder_Is_Hydrated_And_Flow_Built_From_Json_Serializer()
        {
            Registrar.RegisterAsDefault();
            var kernel = new StandardKernel();

            kernel.RegisterBanzaiNodes(GetType().Assembly, true);

            var flowBuilder = new FlowBuilder <object>(new NinjectFlowRegistrar(kernel));

            flowBuilder.CreateFlow("TestFlow1")
            .AddRoot <IPipelineNode <object> >()
            .AddChild <ITestNode2>();

            var serialized = flowBuilder.SerializeRootComponent();

            var component = flowBuilder.DeserializeAndSetRootComponent(serialized);

            var factory = kernel.Get <INodeFactory <object> >();

            var flow = factory.BuildFlow(component);

            flow.ShouldNotBeNull();
        }