Example #1
0
        public void TestMethod1()
        {
            System.Net.ServicePointManager.Expect100Continue = false;
            Page page = new Page();
            Screen scr = new Screen();

            try
            {
                System.Diagnostics.Process.Start(page.ISExe);

                scr.Wait(page.DB, 5);
                scr.Type(page.Username, "Invalid");
                scr.Type(page.Password, "Invalid");
                scr.Click(page.Login);
                scr.Wait(page.TabProfireal, 30);
                scr.Click(page.LoanButton);
                scr.Click(page.TabLoanButton);

                Stopwatch swt = new Stopwatch();
                swt.Start();

                scr.Type(page.Search, "5006010315" + Key.ENTER);
                scr.Wait(page.Paid, 50);
                scr.Click(page.Redaction);
                scr.Wait(page.Request, 50);

                swt.Stop();

                scr.Click(page.RequestExit);
                scr.Click(page.LoanExit);
                scr.Click(page.ISExit);
                scr.Wait(page.WaitQuit, 30);
                scr.Click(page.Quit);

                var time = swt.Elapsed;
                string count = Connecton.GetTop1FromDBBySql("select count(*) from CityAreas;");
                string message = string.Format("{0};{1};{2}", DateTime.Now.ToString(), time.ToString(), count);

                if (File.Exists(page.LogPath))
                {
                    SaveLog(page.LogPath, message);
                }
                else
                {
                    using (StreamWriter sw = File.CreateText(page.LogPath))
                    {
                        sw.WriteLine(string.Format("Date;Time;Count\n{0}", message));
                    }
                }

                throw new ArgumentException();

                if ((int)(time.TotalSeconds) > 10)
                {
                    string body = string.Format("IS report:{0}", time.ToString());
                    EmailSend(page.LogPath, body);
                }

                Wait();
            }
            catch (Exception ex)
            {
                string body = "Error:" + "\t" + ex.ToString() + "\t" + ex.StackTrace;
                EmailSend(page.LogPath, body);
            }
        }
Example #2
0
        public static void Main()
        {
            APILauncher launcher = new APILauncher(true);

            launcher.Start();

            System.Net.ServicePointManager.Expect100Continue = false;
            Page   page = new Page();
            Screen scr  = new Screen();

            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape))
            {
                Connecton.DeleteUser("delete from Invalid where ID_User=Invalid;");

                try
                {
                    System.Diagnostics.Process.Start(page.ISExe);

                    scr.Wait(page.DB, 100);
                    scr.Type(page.Username, "Invalid");
                    scr.Type(page.Password, "Invalid");
                    scr.Click(page.Login);
                    scr.Wait(page.TabProfireal, 100);
                    scr.Click(page.LoanButton);
                    scr.Click(page.TabLoanButton);

                    Stopwatch swt = new Stopwatch();
                    swt.Start();

                    scr.Type(page.Search, "5006010315" + Key.ENTER);
                    scr.Wait(page.Paid, 100);
                    scr.Click(page.Redaction);
                    scr.Wait(page.Request, 100);

                    swt.Stop();

                    scr.Click(page.RequestExit);
                    scr.Click(page.LoanExit);
                    scr.Click(page.ISExit);
                    scr.Wait(page.WaitQuit, 100);
                    scr.Click(page.Quit);

                    var    time    = swt.Elapsed;
                    string count   = Connecton.GetCountBySql("SELECT COUNT(*) FROM Invalid;");
                    string message = string.Format("{0};{1};{2}", DateTime.Now.ToString(), time.ToString(), count);

                    if (File.Exists(page.LogPath))
                    {
                        SaveLog(page.LogPath, message);
                    }
                    else
                    {
                        using (StreamWriter sw = File.CreateText(page.LogPath))
                        {
                            sw.WriteLine(string.Format("Date;Time;Sessions\n{0}", message));
                        }
                    }

                    if ((int)(time.TotalSeconds) > 45)
                    {
                        string body = string.Format("IS report:{0}", time.ToString());
                        EmailSend(page.LogPath, body);
                    }

                    Wait();
                }
                catch (Exception ex)
                {
                    string body = "Error:" + "\t" + ex.ToString() + "\t" + ex.StackTrace;
                    EmailSend(page.LogPath, body);
                }
            }

            launcher.Stop();
        }