Ejemplo n.º 1
0
        public void SocketSendTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            definition.ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 13"])();
        }
Ejemplo n.º 2
0
        public void WorkflowMutationTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            Assert.AreEqual("State 2",
                            definition.ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 3"])()
                            .CurrentActionManager()
                            .StateManager()
                            .CurrentWorkflowState
                            .WorkflowStateConfiguration
                            .StateName);

            Assert.AreEqual("2", definition
                            .ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 4"])()
                            .CurrentActionManager()
                            .StateManager()
                            .CurrentWorkflowState
                            .CurrentParameterValues["Name1"]
                            .Value);
        }
Ejemplo n.º 3
0
        public void WorkflowConditionalExecutionTest()
        {
            //ToDo: Conditional execution is not correct, it should be able to derive the conditional parameter from anywhere
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            Assert.AreEqual("State 4", definition
                            .ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 9"])()
                            .CurrentActionManager()
                            .StateManager()
                            .CurrentWorkflowState
                            .WorkflowStateConfiguration
                            .StateName);
        }
Ejemplo n.º 4
0
        public void WorkflowQueueExecutionTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            definition.ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 11"])();

            var options  = new KafkaOptions(new Uri("http://192.168.99.100:9092"));
            var router   = new BrokerRouter(options);
            var consumer = new Consumer(new ConsumerOptions("workflowtest", router));

            var amessage = consumer.Consume().FirstOrDefault();

            Assert.IsNotNull(amessage);
            Assert.AreEqual("Action 6", amessage.Value.ToUtf8String());
        }