コード例 #1
0
        /// <summary>
        /// Parses emails with attachments to create user stories in Rally if there are unread email messages in the "Inbox" folder
        /// </summary>
        /// <param name="rallyWorkspace"></param>
        /// <param name="rallyScrumTeam"></param>
        public void SyncUsingMimeKit(string rallyWorkspace, string rallyScrumTeam)
        {
            try
            {
                LoginToRally();

                _toCreate[RALLY.WorkSpace] = rallyWorkspace;
                _toCreate[RALLY.Project]   = rallyScrumTeam;

                using (_imapClient)
                {
                    LoginToGmail(_imapClient);
                    SetUpMailbox(_imapClient);

                    if (_unreadMessages > 0)
                    {
                        Console.WriteLine("Syncing-" + _emailMessageIdsList.Count + " Messages");

                        foreach (UniqueId messageId in _emailMessageIdsList)
                        {
                            CreateUserStoryWithEmail(messageId);
                            DownloadAttachments(_message);
                            ProcessAttachments();
                            UploadAttachmentsToRallyUserStory();
                            PostSlackUserStoryNotification();
                            MoveMessagesToProcessedFolder(messageId);
                        }

                        Console.WriteLine("Synced-" + _emailMessageIdsList.Count + " Messages");
                    }
                    else
                    {
                        Console.WriteLine("No Unread Messages Found");
                    }

                    _imapClient.Disconnect(true);
                }
            }
            catch (IOException io)
            {
                Console.WriteLine(io.Message);
            }
            catch (ImapProtocolException imapProtocolException)
            {
                Console.WriteLine(imapProtocolException.Message);
            }
            catch (RallyUnavailableException rallyUnavailableException)
            {
                Console.WriteLine(rallyUnavailableException.Message);
            }
            catch (WebException webException)
            {
                Console.WriteLine(webException.Message);
            }
            finally
            {
                _rallyRestApi.Logout();
            }
        }
コード例 #2
0
        public void AuthenticateWithRallyServer()
        {
            //Arrange
            RallyRestApi api = new RallyRestApi();

            //Act
            if (api.AuthenticationState != RallyRestApi.AuthenticationResult.Authenticated)
            {
                api.Authenticate("*****@*****.**", "iYmcmb24", "https://rally1.rallydev.com", null, false);
            }

            //Assert
            Assert.AreEqual("Authenticated", api.AuthenticationState.ToString());

            api.Logout();
            Assert.AreEqual("NotAuthorized", api.AuthenticationState.ToString());
        }