private static void TestFunctionality(List <IPage> pages)
        {
            //testing pages
            Console.WriteLine(string.Format("{0} {1}", GlobalConstants.ContainigGivenWord, pages[6].ContainsDigits()) + Environment.NewLine);
            Console.WriteLine(string.Format("{0} {1}", GlobalConstants.ContainigDigit, pages[2].ContainsDigits()) + Environment.NewLine);
            Console.WriteLine(string.Format("{0} {1}", GlobalConstants.ContainigGivenWord, pages[5].SearchWord("maximus")) + Environment.NewLine);
            Console.WriteLine(string.Format("{0} {1}", GlobalConstants.ContainigDigit, pages[6].ContainsDigits()) + Environment.NewLine);

            IPage pageOne = pages[0];

            pageOne.AddText("Testing!!!");
            Console.WriteLine(pageOne.BrowsePage());
            pageOne.DeleteText();
            Console.WriteLine(pageOne.BrowsePage());
            pageOne.AddText("Working fine after deleting.");
            Console.WriteLine(pageOne.BrowsePage());

            //Testing "secure password needed" for securedNotepad
            //ISecuredNotepad securedNotepad = new SecuredNotepad(pages, "securedPassword");

            //Trying to use methods in secured notepad with wrong password
            //securedNotepad.AddText(2, "Maecenas eu mauris nec felis feugiat placerat ut quis lacus.", "isThisTheRightPassWord");

            INotepad simpleNotepad = new SimpleNotepad(pages);

            Console.WriteLine(simpleNotepad.SearchWord("lorem"));
            ISecuredNotepad securedNotepad1 = new SecuredNotepad(pages, "PassWord1");

            securedNotepad1.ReplaceText(10, "text is editted!", "PassWord1");
            ISecuredNotepad notepad = new SecuredNotepad(pages, "11111Ab");

            // testing notepads
            Console.WriteLine(notepad.BrowsePage("11111Ab"));
            Console.WriteLine(simpleNotepad.SearchWord("lorem"));
            Console.WriteLine(string.Format("{0} {1}", GlobalConstants.ContentForPagesWithDigits, simpleNotepad.PrintAllPagesWithDigits()));
            Console.WriteLine(simpleNotepad.PrintAllPagesWithDigits());
            simpleNotepad.ReplaceText(5, "i'm the new text !");
            Console.WriteLine(simpleNotepad.PrintAllPagesWithDigits());

            //testing Electronic secured notepad
            ElectronicSecuredNotepad electronicSecuredNotepad = new ElectronicSecuredNotepad(pages, "coolPassword");

            //Trying to use funtionality of electronic secured notepad before switching it on
            //electronicSecuredNotepad.AddText(1, "some text", "coolPassword");

            electronicSecuredNotepad.Start();
            electronicSecuredNotepad.AddText(9, "adding some text", "coolPassword");
            Console.WriteLine(electronicSecuredNotepad.BrowsePage("coolPassword"));
            electronicSecuredNotepad.DeleteText(1, "coolPassword");
            electronicSecuredNotepad.ReplaceText(2, "new text", "coolPassword");
            Console.WriteLine(electronicSecuredNotepad.BrowsePage("coolPassword"));
            electronicSecuredNotepad.Stop();
        }
Exemplo n.º 2
0
        public static void ShowNotepad(bool showPauseButton = true)
        {
            SimpleNotepad notepad = new SimpleNotepad();

            try
            {
                var navPushResult = Globals.Navigation.Push(notepad);
                notepad.Show();

                do
                {
                    if (showPauseButton)
                    {
                        notepad.ShowPause(showPauseButton);
                        notepad.SetPauseState(Globals.PauseGameWhenOpen);
                    }

                    GameFiber.Yield();
                }while (!CloseComputerPlusWindow.IsPressed && (Globals.Navigation.Head == notepad || notepad.IsOpen()));
                notepad.Close();
            }
            catch { }
        }