Exemplo n.º 1
0
        void testLogin2()
        {
            Console.WriteLine();
            Console.WriteLine("TESTING MORE ABOUT LOGIN...");

            try
            {
                if (service.loggedAsUser())
                {
                    Console.WriteLine("   User " + service.userLogged().Name + " logged in");
                }
                else if (service.loggedAsEmployee())
                {
                    Console.WriteLine("   Employee " + service.employeeLogged().Name + " logged in");
                }
                else
                {
                    Console.WriteLine("   Nobody logged in");
                }

                service.logout();

                if (service.loggedAsUser())
                {
                    Console.WriteLine("   User " + service.userLogged().Name + " logged in");
                }
                else if (service.loggedAsEmployee())
                {
                    Console.WriteLine("   Employee " + service.employeeLogged().Name + " logged in");
                }
                else
                {
                    Console.WriteLine("   Nobody logged in");
                }

                service.login("user1", "user1");
                if (service.loggedAsUser())
                {
                    Console.WriteLine("   User " + service.userLogged().Name + " logged in");
                }
                else if (service.loggedAsEmployee())
                {
                    Console.WriteLine("   Employee " + service.employeeLogged().Name + " logged in");
                }
                else
                {
                    Console.WriteLine("   Nobody logged in");
                }
            }
            catch (Exception e)
            {
                printError(e);
            }
        }