internal void resetEmail(AutomationEngineInstance _engine)
        {
            _sendOutlookEmail = new SendOutlookEmailCommand();

            _sendOutlookEmail.v_Recipients = "*****@*****.**";
            _sendOutlookEmail.v_Subject    = "toDelete";
            _sendOutlookEmail.v_Body       = "testBody";
            _sendOutlookEmail.v_BodyType   = "Plain";

            _sendOutlookEmail.RunCommand(_engine);
        }
        public void SendsOutlookEmail()
        {
            _engine           = new AutomationEngineInstance(null);
            _sendOutlookEmail = new SendOutlookEmailCommand();
            _getOutlookEmails = new GetOutlookEmailsCommand();

            _sendOutlookEmail.v_Recipients = "*****@*****.**";
            _sendOutlookEmail.v_Subject    = "testSend";
            _sendOutlookEmail.v_Body       = "testBody";
            _sendOutlookEmail.v_BodyType   = "Plain";

            _sendOutlookEmail.RunCommand(_engine);

            VariableMethods.CreateTestVariable(null, _engine, "emails", typeof(List <>));
            List <MailItem> emails;
            int             attempts = 0;

            do
            {
                System.Threading.Thread.Sleep(5000);
                _getOutlookEmails.v_SourceFolder  = "Inbox";
                _getOutlookEmails.v_Filter        = "[Subject] = 'testSend'";
                _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);
            MailItem email = emails[0];

            Assert.Equal("testSend", email.Subject);

            resetSendEmail(_engine, email);
        }
Ejemplo n.º 3
0
        private async 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>)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);

            _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);
        }