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); }
public void SCFileReceiveMessage() { string aFileName = ClearEnvironmentForTest(); ContextClient contextClient = SetUpContextClient(); var sendMessageContextActivity = new SendMessageActivity { To = Test_SendDestination, Action = Test_SendMessage_Action, ArgumentsJson = Test_SendMessage_Arguments, ContextClient = new InArgument <ContextClient>((ctx) => contextClient) }; var receiveMessageContextActivity = new ReceiveMessageActivity { ContextClient = new InArgument <ContextClient>((ctx) => contextClient) }; WorkflowInvoker.Invoke(sendMessageContextActivity); var output = WorkflowInvoker.Invoke(receiveMessageContextActivity); contextClient.MyDispose(); string fileContents = File.ReadAllText(aFileName); Assert.IsTrue(output["Action"].ToString() == Test_SendMessage_Action); Assert.IsTrue(output["ArgumentsJson"].ToString() == Test_SendMessage_Arguments); Assert.IsTrue(output["To"].ToString() == Test_SendOrigin); Assert.IsTrue(output["From"].ToString() == Test_SendOrigin); Assert.IsTrue(((DateTime)output["TimeSent"]).ToString("YYYY-MM-DD") == DateTime.Now.ToString("YYYY-MM-DD")); Assert.IsTrue(!(bool)output["MessageQueueEmpty"]); Assert.IsTrue(fileContents == "{\"GlobalVariables\":{},\"Messages\":{\"DummyProcess\":[]}}"); }
private void CleanupContext() { if (aContext != null) { aContext.MyDispose(); } }
public void SCFileReceiveMessageEmpty() { string aFileName = ClearEnvironmentForTest(); ContextClient contextClient = SetUpContextClient(); var receiveMessageContextActivity = new ReceiveMessageActivity { ContextClient = new InArgument <ContextClient>((ctx) => contextClient) }; var output = WorkflowInvoker.Invoke(receiveMessageContextActivity); contextClient.MyDispose(); string fileContents = File.ReadAllText(aFileName); Assert.IsTrue((bool)output["MessageQueueEmpty"]); Assert.IsTrue(fileContents == "{\"GlobalVariables\":{},\"Messages\":{\"DummyProcess\":[]}}"); }
public void SCFileSendMessage() { string aFileName = ClearEnvironmentForTest(); ContextClient contextClient = SetUpContextClient(); var sendMessageContextActivity = new SendMessageActivity { To = Test_SendDestination, Action = Test_SendMessage_Action, ArgumentsJson = Test_SendMessage_Arguments, ContextClient = new InArgument <ContextClient>((ctx) => contextClient) }; var output = WorkflowInvoker.Invoke(sendMessageContextActivity); contextClient.MyDispose(); string fileContents = File.ReadAllText(aFileName); Assert.IsTrue(fileContents.Contains("{\"GlobalVariables\":{},\"Messages\":{\"DummyProcess\":[{\"From\":\"DummyProcess\",\"To\":\"DummyProcess\",\"Action\":\"Do-Something\",\"ArgumentsJson\":\"{\\\"some_argument\\\":\\\"aValue\\\"}\",\"DateSent\":")); }