Esempio n. 1
0
        public void OrchestrationProjectSolveTest()
        {
            Mock <IOrchestratorRepository <string> > mockStringRepo = new Mock <IOrchestratorRepository <string> >();
            Mock <IOrchestratorRepository <int> >    mockIntRepo    = new Mock <IOrchestratorRepository <int> >();

            string byString = "ByString";
            string byInt    = "ByInt";

            bool stringOrchestratorEnded = false;
            bool intOrchestratorEnded    = false;

            EquationProject project = new EquationProject()
            {
                Equations = new List <Equation>()
                {
                    new Equation()
                    {
                        Expression    = "false",
                        Target        = byString,
                        UseExpression = "true"
                    },
                    new Equation()
                    {
                        Expression    = "false",
                        Target        = byInt,
                        UseExpression = "true"
                    }
                }
            };

            IOrchestration orchestration = new Orchestration(project);

            IOrchestrator <string> stringOrchestrator = new Orchestrator <string>(byString, mockStringRepo.Object);

            stringOrchestrator.OrchestratorEnded += delegate(object sender, EventArgs args)
            {
                stringOrchestratorEnded = true;
            };

            IOrchestrator <int> intOrchestrator = new Orchestrator <int>(byInt, mockIntRepo.Object);

            intOrchestrator.OrchestratorEnded += delegate(object sender, EventArgs args)
            {
                intOrchestratorEnded = true;
            };

            orchestration.SetOrchestrator(stringOrchestrator);
            orchestration.SetOrchestrator(intOrchestrator);

            orchestration.SolveEquations();

            Thread.Sleep(1000);

            Assert.True(stringOrchestratorEnded);
            Assert.True(intOrchestratorEnded);
        }
 /// <summary>
 /// Default Ctor
 /// </summary>
 /// <param name="project">supply the equation project (optional)</param>
 public Orchestration(EquationProject project = null)
 {
     _equationProject = project;
 }