Esempio n. 1
0
        void testLogin()
        {
            User u;

            Console.WriteLine();
            Console.WriteLine("TESTING LOGIN...");

            try
            {
                u = service.login("user1", "user1");
                if (u != null)
                {
                    Console.WriteLine("  Login " + u.Name);
                }
                else
                {
                    Console.WriteLine("  NOLOGIN");
                }
            }
            catch (Exception e)
            {
                printError(e);
            }
            service.logout();

            try
            {
                u = service.login("user2", "user2");
                if (u != null)
                {
                    Console.WriteLine("  Login " + u.Name);
                }
                else
                {
                    Console.WriteLine("  NOLOGIN");
                }
            }
            catch (Exception e)
            {
                printError(e);
            }
            service.logout();

            try
            {
                u = service.login("user5", "user1");
                if (u != null)
                {
                    Console.WriteLine("  Login " + u.Name);
                }
                else
                {
                    Console.WriteLine("  NOLOGIN");
                }
            }
            catch (Exception e)
            {
                printError(e);
            }
            service.logout();

            try
            {
                Employee e = service.login("11111111A", 1234);
                if (e != null)
                {
                    Console.WriteLine("  Login " + e.Name);
                }
                else
                {
                    Console.WriteLine("  NOLOGIN");
                }
            }
            catch (Exception exc)
            {
                printError(exc);
            }
            service.logout();

            try
            {
                Employee e = service.login("12341234A", 1234);
                if (e != null)
                {
                    Console.WriteLine("  Login " + e.Name);
                }
                else
                {
                    Console.WriteLine("  NOLOGIN");
                }
            }
            catch (Exception exc)
            {
                printError(exc);
            }
        }