public void ForwardsOutlookEmail() { _engine = new AutomationEngineInstance(null); _getOutlookEmails = new GetOutlookEmailsCommand(); _forwardOutlookEmail = new ForwardOutlookEmailCommand(); _deleteOutlookEmail = new DeleteOutlookEmailCommand(); VariableMethods.CreateTestVariable(null, _engine, "emails", typeof(List <>)); _getOutlookEmails.v_SourceFolder = "TestInput"; _getOutlookEmails.v_Filter = "[Subject] = 'toForward'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); var emails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); MailItem email = emails[0]; VariableMethods.CreateTestVariable(email, _engine, "email", typeof(MailItem)); string forwardAddress = "*****@*****.**"; VariableMethods.CreateTestVariable(forwardAddress, _engine, "forwardEmail", typeof(string)); _forwardOutlookEmail.v_MailItem = "{email}"; _forwardOutlookEmail.v_Recipients = "{forwardEmail}"; _forwardOutlookEmail.RunCommand(_engine); int attempts = 0; do { System.Threading.Thread.Sleep(5000); _getOutlookEmails.v_SourceFolder = "Inbox"; _getOutlookEmails.v_Filter = "[Subject] = 'toForward'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); emails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); attempts++; } while (emails.Count < 1 & attempts < 5); email = emails[0]; Assert.Equal("*****@*****.**", email.Sender.Address); Assert.Equal("FW: toForward", email.Subject); resetEmail(_engine, email); }
private async void resetCopyEmail(AutomationEngineInstance _engine) { _deleteOutlookEmail = new DeleteOutlookEmailCommand(); _getOutlookEmails = new GetOutlookEmailsCommand(); VariableMethods.CreateTestVariable(null, _engine, "emails", typeof(List <>)); _getOutlookEmails.v_SourceFolder = "MovedMail"; _getOutlookEmails.v_Filter = "[Subject] = 'toCopy'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); var emails = (List <MailItem>)await "{emails}".EvaluateCode(_engine); MailItem email = emails[0]; VariableMethods.CreateTestVariable(email, _engine, "email", typeof(MailItem)); _deleteOutlookEmail.v_MailItem = "{email}"; _deleteOutlookEmail.v_DeleteReadOnly = "No"; _deleteOutlookEmail.RunCommand(_engine); }
private void resetSendEmail(AutomationEngineInstance _engine, MailItem email) { _deleteOutlookEmail = new DeleteOutlookEmailCommand(); VariableMethods.CreateTestVariable(email, _engine, "email", typeof(List <>)); _deleteOutlookEmail.v_MailItem = "{email}"; _deleteOutlookEmail.v_DeleteReadOnly = "No"; _deleteOutlookEmail.RunCommand(_engine); }
internal void DeleteEmail(object emailMessage) { _deleteEmail = new DeleteOutlookEmailCommand(); VariableMethods.CreateTestVariable(null, _engine, "vMailItem", typeof(MailItem)); _deleteEmail.v_MailItem = "{vMailItem}"; emailMessage.SetVariableValue(_engine, _deleteEmail.v_MailItem); _deleteEmail.v_DeleteReadOnly = "Yes"; _deleteEmail.RunCommand(_engine); }
public void DeletesOutlookEmail() { _engine = new AutomationEngineInstance(null); _deleteOutlookEmail = new DeleteOutlookEmailCommand(); _getOutlookEmails = new GetOutlookEmailsCommand(); VariableMethods.CreateTestVariable(null, _engine, "emails", typeof(List <>)); _getOutlookEmails.v_SourceFolder = "Inbox"; _getOutlookEmails.v_Filter = "[Subject] = 'toDelete'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); var emails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); if (emails.Count == 0) { throw new System.ArgumentException("Test email 'toDelete' was not found"); } MailItem email = emails[0]; VariableMethods.CreateTestVariable(email, _engine, "email", typeof(MailItem)); _deleteOutlookEmail.v_MailItem = "{email}"; _deleteOutlookEmail.v_DeleteReadOnly = "No"; _deleteOutlookEmail.RunCommand(_engine); _getOutlookEmails.v_SourceFolder = "Inbox"; _getOutlookEmails.v_Filter = "[Subject] = 'toDelete'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); List <MailItem> postEmails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); resetEmail(_engine); Assert.Empty(postEmails); }
private void resetMoveEmail(AutomationEngineInstance _engine) { _deleteOutlookEmail = new DeleteOutlookEmailCommand(); _getOutlookEmails = new GetOutlookEmailsCommand(); _sendOutlookEmail = new SendOutlookEmailCommand(); VariableMethods.CreateTestVariable(null, _engine, "emails", typeof(List <>)); _getOutlookEmails.v_SourceFolder = "MovedMail"; _getOutlookEmails.v_Filter = "[Subject] = 'toMove'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); var emails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); MailItem email = emails[0]; VariableMethods.CreateTestVariable(email, _engine, "email", typeof(MailItem)); _deleteOutlookEmail.v_MailItem = "{email}"; _deleteOutlookEmail.v_DeleteReadOnly = "No"; _deleteOutlookEmail.RunCommand(_engine); _sendOutlookEmail.v_Recipients = "*****@*****.**"; _sendOutlookEmail.v_Subject = "toMove"; _sendOutlookEmail.v_Body = "testBody"; _sendOutlookEmail.v_BodyType = "Plain"; _sendOutlookEmail.RunCommand(_engine); }
private void resetReplyEmail(AutomationEngineInstance _engine) { _deleteOutlookEmail = new DeleteOutlookEmailCommand(); _getOutlookEmails = new GetOutlookEmailsCommand(); _sendOutlookEmail = new SendOutlookEmailCommand(); _moveCopyOutlookEmail = new MoveCopyOutlookEmailCommand(); VariableMethods.CreateTestVariable(null, _engine, "emails", typeof(List <>)); _getOutlookEmails.v_SourceFolder = "Inbox"; _getOutlookEmails.v_Filter = "[Subject] = 'toReply'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); List <MailItem> emails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); MailItem email = emails[0]; VariableMethods.CreateTestVariable(email, _engine, "email", typeof(MailItem)); _deleteOutlookEmail.v_MailItem = "{email}"; _deleteOutlookEmail.v_DeleteReadOnly = "No"; _deleteOutlookEmail.RunCommand(_engine); _getOutlookEmails.v_SourceFolder = "TestInput"; _getOutlookEmails.v_Filter = "[Subject] = 'toReply'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); emails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); email = emails[0]; VariableMethods.CreateTestVariable(email, _engine, "email", typeof(MailItem)); _deleteOutlookEmail.v_MailItem = "{email}"; _deleteOutlookEmail.v_DeleteReadOnly = "No"; _deleteOutlookEmail.RunCommand(_engine); _sendOutlookEmail.v_Recipients = "*****@*****.**"; _sendOutlookEmail.v_Subject = "toReply"; _sendOutlookEmail.v_Body = "testBody"; _sendOutlookEmail.v_BodyType = "Plain"; _sendOutlookEmail.RunCommand(_engine); int attempts = 0; do { System.Threading.Thread.Sleep(5000); _getOutlookEmails.v_SourceFolder = "Inbox"; _getOutlookEmails.v_Filter = "[Subject] = 'toReply'"; _getOutlookEmails.v_GetUnreadOnly = "No"; _getOutlookEmails.v_MarkAsRead = "No"; _getOutlookEmails.v_SaveMessagesAndAttachments = "No"; _getOutlookEmails.v_MessageDirectory = ""; _getOutlookEmails.v_AttachmentDirectory = ""; _getOutlookEmails.v_OutputUserVariableName = "{emails}"; _getOutlookEmails.RunCommand(_engine); emails = (List <MailItem>) "{emails}".ConvertUserVariableToObject(_engine, typeof(List <>)); attempts++; } while (attempts < 5 && emails.Count < 1); email = emails[0]; VariableMethods.CreateTestVariable(email, _engine, "email", typeof(MailItem)); _moveCopyOutlookEmail.v_MailItem = "{email}"; _moveCopyOutlookEmail.v_DestinationFolder = "TestInput"; _moveCopyOutlookEmail.v_OperationType = "Move MailItem"; _moveCopyOutlookEmail.v_MoveCopyUnreadOnly = "No"; _moveCopyOutlookEmail.RunCommand(_engine); }