ForumClientCore.ClientController.Logout C# (CSharp) Method

Logout() public method

public Logout ( ) : bool
return bool
        public bool Logout()
        {
            if (!loggedIn)
            {
                return true;
            }
            if (netAdaptor.Logout(loggedAs) == Result.OK)
            {
                loggedAs = "";
                loggedPassword = "";
                loggedIn = false;
                return true;
            }
            else
            {
                return false;
            }
        }

Usage Example

Example #1
0
        public void LogoutTests()
        {
            // logout tests
            ClientController cc2 = new ClientController();
               // Assert.IsFalse(cc2.Logout());//try to logout without any register and login

            cc2.Register("alice", "123456");
            Assert.IsTrue(cc2.Logout());//try to logout without login

            cc2.Login("alice", "123456");
            Assert.IsTrue(cc2.Logout());//try to logout after login
        }