public void SearchForOwnedAndRename()
        {
            var search = new ConversationSearcher(metlWindow.AutomationElement);

            search.searchField(TestConstants.OWNER_CONVERSATION_TITLE);
            search.Search();

            if (!search.ResultsContainQueried(TestConstants.OWNER_CONVERSATION_TITLE))
            {
                CreateAndRenameConversation();
            }

            search.SelectConversation(TestConstants.OWNER_CONVERSATION_TITLE);
            var guid = Guid.NewGuid();

            var edit = new ConversationEditScreen(metlWindow.AutomationElement);
            edit.Rename(TestConstants.OWNER_CONVERSATION_TITLE + "renamed" + guid).Save();

            search = new ConversationSearcher(metlWindow.AutomationElement);

            search.searchField(TestConstants.OWNER_CONVERSATION_TITLE);
            search.Search();

            search.SelectConversation(TestConstants.OWNER_CONVERSATION_TITLE + "renamed" + guid);

            edit = new ConversationEditScreen(metlWindow.AutomationElement);
            edit.Rename(TestConstants.OWNER_CONVERSATION_TITLE).Save();
        }
        public void DeleteSelectedConversation()
        {
            var search = new ConversationSearcher(metlWindow.AutomationElement);
            search.SelectConversation(TestConstants.OWNER_CONVERSATION_TITLE);

            var edit = new ConversationEditScreen(metlWindow.AutomationElement);
            edit.Delete();
        }
        public void ChangePrivacyToOnlyOwner()
        {
            var results = new UITestHelper(metlWindow);
            results.SearchProperties.Add(new PropertyExpression(AutomationElement.AutomationIdProperty, Constants.ID_METL_CONVERSATION_SEARCH_RESULTS));

            results.WaitForControlCondition((uiControl) => { return Rect.Empty.Equals(uiControl.GetCurrentPropertyValue(AutomationElement.BoundingRectangleProperty)); });

            var editConversation = new ConversationEditScreen(results.AutomationElement);

            editConversation.ChangeGroup(TestConstants.OWNER_USERNAME).Save().ReturnToCurrent();
        }
        public void PrivacyIsSetToUnrestricted()
        {
            var results = new UITestHelper(metlWindow);
            results.SearchProperties.Add(new PropertyExpression(AutomationElement.AutomationIdProperty, Constants.ID_METL_CONVERSATION_SEARCH_RESULTS));
            results.OverrideTimeout = 5000;

            results.WaitForControlCondition((uiControl) => { return Rect.Empty.Equals(uiControl.GetCurrentPropertyValue(AutomationElement.BoundingRectangleProperty)); });

            var editConversation = new ConversationEditScreen(results.AutomationElement);

            bool selected = false;
                
            editConversation.IsGroupSelected(TestConstants.AUTH_GROUP_UNRESTRICTED, out selected).Save().ReturnToCurrent();
            Assert.IsTrue(selected, ErrorMessages.EXPECTED_SET_PRIVACY);
        }
        public void CreateAndRenameConversation(UITestHelper window, string conversationTitle)
        {
            // create a new conversation with the name of the computer appended
            new ApplicationPopup(window.AutomationElement).CreateConversation();

            UITestHelper.Wait(TimeSpan.FromSeconds(2));

            SwitchToSearchCurrentConversation(window);

            UITestHelper.Wait(TimeSpan.FromSeconds(2));

            var edit = new ConversationEditScreen(window.AutomationElement);

            edit.Rename(conversationTitle).Save();
        }
        public void DeleteCurrentConversation()
        {
            var results = new UITestHelper(metlWindow);
            results.SearchProperties.Add(new PropertyExpression(AutomationElement.AutomationIdProperty, Constants.ID_METL_CONVERSATION_SEARCH_RESULTS));

            results.WaitForControlCondition((uiControl) => { return Rect.Empty.Equals(uiControl.GetCurrentPropertyValue(AutomationElement.BoundingRectangleProperty)); });
            
            var editConversation = new ConversationEditScreen(results.AutomationElement);

            editConversation.Delete();
        }