public static void ShareBookWithTeacher(Login student, Login teacher, BookShape shape)
        {
            BookBuilderCommonMethods.CreateBook(student.UserName, student.PersonName, shape);
            string assertFailureMessage;
            //TC53953
            Assert.IsTrue(BookBuilderCommonMethods.VerifyBookIsAtCenterOfScreen(out assertFailureMessage), assertFailureMessage);
            //TC53965
            Assert.IsTrue(BookBuilderCommonMethods.VerifyShareIconIsAtRightSideOfEditButton(), "Share icon not at rigt of edit button");
            BookBuilderCommonMethods.ClickShareIconInBookBuilder();

            //TC53966
            Assert.IsTrue(NotebookCommonMethods.VerifyShareNotebookConfirmationPrompt(), "Share confirmation not found");
            Assert.IsTrue(NotebookCommonMethods.VerifyShareNotebookConfirmationTeacherListScroll(), "teacher list no scrolling");
            //TC53967
            NotebookCommonMethods.ClickXCloseIconInSharePrompt();

            Assert.IsFalse(NotebookCommonMethods.VerifyShareNotebookConfirmationPrompt(), "Share confirmation still found");
            BookBuilderCommonMethods.ClickShareIconInBookBuilder();
            NotebookCommonMethods.SelectTeacherinSharePrompt(teacher.PersonName);

            NotebookCommonMethods.ClickCheckSendIconInSharePrompt();
            //TC53968
            Assert.IsTrue(NotebookCommonMethods.VerifyNotebookSentMessage(), "notebook sent message not found");
            NotebookCommonMethods.CloseNotebookSentPopup();
        }
 /// <summary>
 /// Creates a new book
 /// </summary>
 /// <param name="title">Title of the book</param>
 /// <param name="author">Author of the book</param>
 /// <param name="bookshape">bookshape</param>
 public static void CreateBook(string title, string author, BookShape bookshape = BookShape.Portrait)
 {
     if (AutomationAgent.VerifyControlExists("BookBuilderView", "BookBuilderNewBookOnFirstTime", 100))
     {
         AutomationAgent.Click("BookBuilderView", "BookBuilderNewBookOnFirstTime");
         if (bookshape.Equals(BookShape.Portrait))
         {
             AutomationAgent.Click("BookBuilderView", "BookBuilderPortraitOnFirstTime");
         }
         else if (bookshape.Equals(BookShape.Landscape))
         {
             AutomationAgent.Click("BookBuilderView", "BookBuilderLandscapeOnFirstTime");
         }
         else if (bookshape.Equals(BookShape.Square))
         {
             AutomationAgent.Click("BookBuilderView", "BookBuilderSquareOnFirstTime");
         }
     }
     else
     {
         if (!AutomationAgent.VerifyControlExists("BookBuilderView", "Popup", 100))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookIcon");
         }
         if (bookshape.Equals(BookShape.Portrait))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookPortraitIcon");
         }
         else if (bookshape.Equals(BookShape.Landscape))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookLandscapeIcon");
         }
         else if (bookshape.Equals(BookShape.Square))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookSquareIcon");
         }
     }
     SetBookTitleAndAuthor(title, author);
 }
        /// <summary>
        /// Verifies various controls on Book Builder page
        /// </summary>
        /// <param name="shape">shape of book</param>
        /// <param name="assertFailureMessage">message</param>
        /// <returns>true if all controls are found</returns>
        public static bool VerifyElementsOfBookBuilderPage(BookShape shape, out string assertFailureMessage)
        {
            assertFailureMessage = string.Empty;
            bool exists = true;
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageMoveTool"))
            {
                assertFailureMessage += "Book Builder PageMoveTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageEraserTool"))
            {
                assertFailureMessage += "Book Builder PageEraserTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageColourTool"))
            {
                assertFailureMessage += "Book Builder PageColourTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageStampTool"))
            {
                assertFailureMessage += "Book Builder PageStampTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageTypeTool"))
            {
                assertFailureMessage += "Book Builder PageTypeTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageBrushTool"))
            {
                assertFailureMessage += "Book Builder PageBrushTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageMarkerTool"))
            {
                assertFailureMessage += "Book Builder PageMarkerTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageCrayonTool"))
            {
                assertFailureMessage += "Book Builder PageCrayonTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageTableTool"))
            {
                assertFailureMessage += "Book Builder PageTableTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageBackgroundTool"))
            {
                assertFailureMessage += "Book Builder PageBackgroundTool is not available. ";
                exists = false;
            }
            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageCameraTool"))
            {
                assertFailureMessage += "Book Builder PageCameraTool is not available. ";
                exists = false;
            }

            int widthOfShape = AutomationAgent.GetControlWidth("BookBuilderView", "Page", 0);
            int heightOfShape = AutomationAgent.GetControlHeight("BookBuilderView", "Page", 0);
            if (shape.Equals(BookShape.Landscape))
            {
                exists = widthOfShape > heightOfShape;
            }
            else if (shape.Equals(BookShape.Portrait))
            {
                exists = widthOfShape < heightOfShape;
            }
            else if (shape.Equals(BookShape.Square))
            {
                exists = widthOfShape == heightOfShape;
            }
            if (!exists)
            {
                assertFailureMessage += "Book " + shape + " doesn't exist";
            }
            return exists;
        }
        public static bool VerifyBookShapeInbox(BookShape bookshape)
        {
            int widthOfShape = AutomationAgent.GetControlWidth("InboxView", "InboxSharedWorkTileItem");
            int heightOfShape = AutomationAgent.GetControlHeight("InboxView", "InboxSharedWorkTileItem");

               if (bookshape.Equals(BookShape.Landscape))
               {
               return widthOfShape > heightOfShape;
               }
               else if (bookshape.Equals(BookShape.Portrait))
               {
               return widthOfShape < heightOfShape;
               }
               else if (bookshape.Equals(BookShape.Square))
               {
               return widthOfShape == heightOfShape;
               }

               return false;
        }
 /// <summary>
 /// Verifies Book shape by their width
 /// </summary>
 /// <param name="assertFailureMessage">Failure message</param>
 /// <param name="bookshape">bookshape</param>
 /// <param name="bookindex">book index</param>
 /// <returns>true if all elements are found</returns>
 public static bool VerifyBookShape(out string assertFailureMessage, BookShape bookshape = BookShape.Portrait, string bookindex = "1")
 {
     assertFailureMessage = string.Empty;
     bool exists = true;
     int widthOfShape = AutomationAgent.GetControlWidth("BookBuilderView", "BookBuilderCover", 0, bookindex);
     int heightOfShape = AutomationAgent.GetControlHeight("BookBuilderView", "BookBuilderCover", 0, bookindex);
     if (bookshape.Equals(BookShape.Landscape))
     {
         exists = widthOfShape > heightOfShape;
     }
     else if (bookshape.Equals(BookShape.Portrait))
     {
         exists = widthOfShape < heightOfShape;
     }
     else if (bookshape.Equals(BookShape.Square))
     {
         exists = widthOfShape == heightOfShape;
     }
     if(!exists) {
         assertFailureMessage += "Book " + bookshape + " doesn't exist";
     }
     return exists;
 }
 /// <summary>
 /// Verifies the previously added books partially visible
 /// </summary>
 /// <param name="assertFailureMessage">Failure message</param>
 /// <param name="firstBook">book name which is added first</param>
 /// <param name="secondBook">book name which is added second</param>
 /// <param name="bookshape">bookshape</param>
 /// <param name="bookindex">book index</param>
 /// <returns>true if all element exist</returns>
 public static bool VerifyBookPreviouslyAddedBookIsPartially(out string assertFailureMessage, string firstBook, string secondBook, BookShape bookshape = BookShape.Portrait, string bookindex = "1")
 {
     assertFailureMessage = string.Empty;
     bool exists = false;
     if (!VerifyBookOrder(firstBook, secondBook))
     {
         assertFailureMessage += "Lastly added book is not on left. ";
     }
     int widthOfShape = AutomationAgent.GetControlWidth("BookBuilderView", "BookBuilderCover", 0, "2");
     if (bookshape.Equals(BookShape.Landscape))
     {
         exists = widthOfShape < 475;
     }
     else if (bookshape.Equals(BookShape.Portrait))
     {
         exists = widthOfShape < 278;
     }
     else if (bookshape.Equals(BookShape.Square))
     {
         exists = widthOfShape < 363;
     }
     if (!exists)
     {
         assertFailureMessage += "Book " + bookshape + " partially doesn't exist";
     }
     return exists;
 }
        /// <summary>
        /// Verifies elements and sends error if any failure happens
        /// </summary>
        /// <param name="shape">Shape of book</param>
        /// <param name="assertFailureMessage">Failure message</param>
        /// <returns>true if all components are found</returns>
        public static bool VerifyBookBuilderCreateNewBook(BookShape shape, out string assertFailureMessage)
        {
            assertFailureMessage = string.Empty;
            bool exists = true;
            if (AutomationAgent.VerifyControlExists("LoginView", "NavigationBarGoBackButton"))
            {
                int xOfGoBack = AutomationAgent.GetControlPositionX("LoginView", "NavigationBarGoBackButton");
                int widthOfGoBack = AutomationAgent.GetControlWidth("LoginView", "NavigationBarGoBackButton");
                if (xOfGoBack + widthOfGoBack > 150)
                {
                    assertFailureMessage += "Go Back is not on left top corner. ";
                    exists = false;
                }
            }
            else
            {
                assertFailureMessage += "Back button is not available. ";
                exists = false;
            }

            int xOfBBTitle = AutomationAgent.GetControlPositionX("BookBuilderView", "BookBuilderTitle");
            int widthOfBBTitle = AutomationAgent.GetControlWidth("BookBuilderView", "BookBuilderTitle");
            int yOfBBTitle = AutomationAgent.GetControlPositionY("BookBuilderView", "BookBuilderTitle");
            int appWinMidPointX = AutomationAgent.GetAppWindowWidth() / 2;
            int bbTitleMidPointX = xOfBBTitle + widthOfBBTitle / 2;
            if (yOfBBTitle < 50 && (bbTitleMidPointX == appWinMidPointX || bbTitleMidPointX - appWinMidPointX < 5 || appWinMidPointX - bbTitleMidPointX < 5))
            {
                ;
            }
            else
            {
                assertFailureMessage = "Book title is not in the top center. ";
            }

            xOfBBTitle = AutomationAgent.GetControlPositionX("BookBuilderView", "BookBuilderTitleText");
            widthOfBBTitle = AutomationAgent.GetControlWidth("BookBuilderView", "BookBuilderTitleText");
            yOfBBTitle = AutomationAgent.GetControlPositionY("BookBuilderView", "BookBuilderTitleText");
            appWinMidPointX = AutomationAgent.GetAppWindowWidth() / 2;
            bbTitleMidPointX = xOfBBTitle + widthOfBBTitle / 2;
            if (bbTitleMidPointX == appWinMidPointX || bbTitleMidPointX - appWinMidPointX < 5 || appWinMidPointX - bbTitleMidPointX < 5)
            {
                ;
            }
            else
            {
                assertFailureMessage = "Title is not in the center. ";
            }

            xOfBBTitle = AutomationAgent.GetControlPositionX("BookBuilderView", "BY");
            widthOfBBTitle = AutomationAgent.GetControlWidth("BookBuilderView", "BY");
            int yOfBYTitle = AutomationAgent.GetControlPositionY("BookBuilderView", "BY");
            appWinMidPointX = AutomationAgent.GetAppWindowWidth() / 2;
            bbTitleMidPointX = xOfBBTitle + widthOfBBTitle / 2;
            if (yOfBBTitle < yOfBYTitle && (bbTitleMidPointX == appWinMidPointX || bbTitleMidPointX - appWinMidPointX < 5 || appWinMidPointX - bbTitleMidPointX < 5))
            {
                ;
            }
            else
            {
                assertFailureMessage = "BY is not in the center. ";
            }

            xOfBBTitle = AutomationAgent.GetControlPositionX("BookBuilderView", "BookBuilderAuthorText");
            widthOfBBTitle = AutomationAgent.GetControlWidth("BookBuilderView", "BookBuilderAuthorText");
            int yOfAuthorName = AutomationAgent.GetControlPositionY("BookBuilderView", "BookBuilderAuthorText");
            appWinMidPointX = AutomationAgent.GetAppWindowWidth() / 2;
            bbTitleMidPointX = xOfBBTitle + widthOfBBTitle / 2;
            if (yOfAuthorName > yOfBYTitle && (bbTitleMidPointX == appWinMidPointX || bbTitleMidPointX - appWinMidPointX < 5 || appWinMidPointX - bbTitleMidPointX < 5))
            {
                ;
            }
            else
            {
                assertFailureMessage = "Author Name is not in the center. ";
            }

            int widthOfShape = AutomationAgent.GetControlWidth("BookBuilderView", "CoverPage", 0, "1");
            int heightOfShape = AutomationAgent.GetControlHeight("BookBuilderView", "CoverPage", 0, "1");
            if (shape.Equals(BookShape.Landscape))
            {
                exists = widthOfShape > heightOfShape;
            }
            else if (shape.Equals(BookShape.Portrait))
            {
                exists = widthOfShape < heightOfShape;
            }
            else if (shape.Equals(BookShape.Square))
            {
                exists = widthOfShape == heightOfShape;
            }
            if (!exists)
            {
                assertFailureMessage += "Cover " + shape + " doesn't exist";
            }

            widthOfShape = AutomationAgent.GetControlWidth("BookBuilderView", "FirstPage", 0, "2");
            heightOfShape = AutomationAgent.GetControlHeight("BookBuilderView", "FirstPage", 0, "2");
            if (shape.Equals(BookShape.Landscape))
            {
                exists = widthOfShape > heightOfShape;
            }
            else if (shape.Equals(BookShape.Portrait))
            {
                exists = widthOfShape < heightOfShape;
            }
            else if (shape.Equals(BookShape.Square))
            {
                exists = widthOfShape == heightOfShape;
            }
            if (!exists)
            {
                assertFailureMessage += "Page 1 " + shape + " doesn't exist";
            }

            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "PageOfBook"))
            {
                assertFailureMessage = "1 number is not present";
                exists = false;
            }

            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "AddPageIcon", 0, "3"))
            {
                assertFailureMessage = "Add Page Icon is not present";
                exists = false;
            }

            if (!AutomationAgent.VerifyControlExists("BookBuilderView", "DeletePage"))
            {
                assertFailureMessage = "Delete Page Icon is not present";
                exists = false;
            }

            return exists;
        }
 /// <summary>
 /// Opens create book page
 /// </summary>
 /// <param name="bookshape">bookshape</param>
 public static void OpenCreateBookPage(BookShape bookshape = BookShape.Portrait)
 {
     if (AutomationAgent.VerifyControlExists("BookBuilderView", "BookBuilderNewBookOnFirstTime", 100))
     {
         AutomationAgent.Click("BookBuilderView", "BookBuilderNewBookOnFirstTime");
         if (bookshape.Equals(BookShape.Portrait))
         {
             AutomationAgent.Click("BookBuilderView", "BookBuilderPortraitOnFirstTime");
         }
         else if (bookshape.Equals(BookShape.Landscape))
         {
             AutomationAgent.Click("BookBuilderView", "BookBuilderLandscapeOnFirstTime");
         }
         else if (bookshape.Equals(BookShape.Square))
         {
             AutomationAgent.Click("BookBuilderView", "BookBuilderSquareOnFirstTime");
         }
     }
     else
     {
         if (!AutomationAgent.VerifyControlExists("BookBuilderView", "Popup", 100))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookIcon");
         }
         if (bookshape.Equals(BookShape.Portrait))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookPortraitIcon");
         }
         else if (bookshape.Equals(BookShape.Landscape))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookLandscapeIcon");
         }
         else if (bookshape.Equals(BookShape.Square))
         {
             AutomationAgent.Click("BookBuilderView", "NewBookSquareIcon");
         }
     }
 }