Ejemplo n.º 1
0
        public void SCFileGetVariable()
        {
            string        aFileName     = ClearEnvironmentForTest();
            ContextClient contextClient = SetUpContextClient();

            var setContextActivity = new SetVariableActivity
            {
                VariableName  = Test_SetVariableName,
                VariableValue = Test_SetVariableValue,
                ContextClient = new InArgument <ContextClient>((ctx) => contextClient)
            };

            var getContextActivity = new GetVariableActivity
            {
                VariableName  = Test_SetVariableName,
                ContextClient = new InArgument <ContextClient>((ctx) => contextClient)
            };

            WorkflowInvoker.Invoke(setContextActivity);
            var output = WorkflowInvoker.Invoke(getContextActivity);

            contextClient.MyDispose();

            string fileContents = File.ReadAllText(aFileName);

            Assert.IsTrue(fileContents == "{\"GlobalVariables\":{\"aVariable123\":\"aValue456\"},\"Messages\":{}}");
            Assert.IsTrue(output["VariableValue"].ToString() == Test_SetVariableValue);
        }
Ejemplo n.º 2
0
        public void SCFileScopeWithSharedContextGetInsideException()
        {
            string aFileName = this.ClearEnvironmentForTest();

            var sharedContextScopeActivity = new ClientScopeActivity
            {
                ContextName = Test_ContextName,
                ContextType = Test_ContextType,
                Retries     = Test_Retries
            };

            var getContextActivity = new GetVariableActivity
            {
                VariableName   = Test_SetVariableName,
                RaiseException = true
            };

            sharedContextScopeActivity.Body.Handler = new Sequence()
            {
                Activities =
                {
                    getContextActivity
                }
            };

            try
            {
                var output = WorkflowInvoker.Invoke(sharedContextScopeActivity);
            }
            catch (Exception e)
            {
                Assert.IsTrue(e.Message == "[SharedContext Client] Variable Name " + Test_SetVariableName + " does not exist in context " + Test_ContextName);
            }
        }
Ejemplo n.º 3
0
        public void SCFileScopeWithSharedContextGetInside()
        {
            string aFileName = this.ClearEnvironmentForTest();

            var sharedContextScopeActivity = new ClientScopeActivity
            {
                ContextName = Test_ContextName,
                ContextType = Test_ContextType,
                Retries     = Test_Retries
            };

            var getContextActivity = new GetVariableActivity
            {
                VariableName   = Test_SetVariableName,
                RaiseException = false
            };

            sharedContextScopeActivity.Body.Handler = new Sequence()
            {
                Activities =
                {
                    getContextActivity
                }
            };

            var output = WorkflowInvoker.Invoke(sharedContextScopeActivity);

            Assert.IsTrue(output["OutputContextFile"].ToString() == aFileName);
        }
Ejemplo n.º 4
0
        public void SCNamedPipeScopeNakedSetGet()
        {
            var aContextServer = this.SetUpContextServer();
            var aContextClient = this.SetUpContextClient();

            var setContextActivity = new SetVariableActivity
            {
                VariableName  = Test_SetVariableName,
                VariableValue = Test_SetVariableValue,
                ContextClient = new InArgument <ContextClient>((ctx) => aContextClient)
            };

            var getContextActivity = new GetVariableActivity
            {
                VariableName  = Test_SetVariableName,
                ContextClient = new InArgument <ContextClient>((ctx) => aContextClient)
            };

            WorkflowInvoker.Invoke(setContextActivity);
            var output = WorkflowInvoker.Invoke(getContextActivity);

            Assert.IsTrue(output["VariableValue"].ToString() == Test_SetVariableValue);

            aContextClient.MyDispose();
            aContextServer.MyDispose();
        }
Ejemplo n.º 5
0
        public void SCNamedPipeScopeWithSharedContextSetGetInside()
        {
            var sharedContextServerScope = new ServerScopeActivity
            {
                ContextName = Test_ContextName
            };

            var sharedContextScopeActivity = new ClientScopeActivity
            {
                ContextName  = Test_ContextName,
                ContextType  = Test_ContextType,
                ClearContext = true,
                Retries      = Test_Retries
            };

            var setContextActivity = new SetVariableActivity
            {
                VariableName  = Test_SetVariableName,
                VariableValue = Test_SetVariableValue
            };

            var getContextActivity = new GetVariableActivity
            {
                VariableName = Test_SetVariableName
            };

            sharedContextServerScope.Body.Handler = new Sequence()
            {
                Activities =
                {
                    sharedContextScopeActivity
                }
            };

            sharedContextScopeActivity.Body.Handler = new Sequence()
            {
                Activities =
                {
                    setContextActivity,
                    getContextActivity
                }
            };

            var output = WorkflowInvoker.Invoke(sharedContextServerScope);
        }