Exemplo n.º 1
0
        public void loginTest()
        {
            DBSubscribedUser db   = DBSubscribedUser.getInstance();
            Session          s    = new Session();
            string           pass = DomainBridge.getInstance().encryptPassword("etay123");

            s.register("etay", pass);
            s.login("etay", "etay123");
            Assert.AreEqual(db.getloggedInUser("etay"), s.getSubscribedUser());
        }
Exemplo n.º 2
0
        public void loginTest()
        {
            DBSubscribedUser db = DBSubscribedUser.getInstance();

            db.cleanDB();
            Session s = new Session();

            s.register("etay", "etay");
            s.login("etay", "etay");
            Assert.AreEqual(db.getloggedInUser("etay"), s.getSubscribedUser());
            db.cleanDB();
        }
Exemplo n.º 3
0
        public void logoutTest()
        {
            DBSubscribedUser db = DBSubscribedUser.getInstance();

            db.cleanDB();
            Session s = new Session();

            s.register("etay", "etay");
            s.login("etay", "etay");
            if (db.getSubscribedUser("etay") == null)
            {
                Assert.Fail();
            }
            s.logout();
            Assert.AreEqual(null, db.getloggedInUser("etay"));
        }
Exemplo n.º 4
0
        public void logoutTest()
        {
            DBSubscribedUser dbsubscribedUser = DBSubscribedUser.getInstance();
            SubscribedUser   sub2             = new SubscribedUser("Gal", "Gadot", new ShoppingBasket());

            dbsubscribedUser.register(sub2);

            Session   session = new Session();
            UserState state   = session.getState();

            state.login("Gal", "Gadot", session);
            SubscribedUser user = session.getSubscribedUser();

            session.getState().logout(user, session);
            Assert.IsTrue(session.getState() is Guest);
            Assert.IsNull(dbsubscribedUser.getloggedInUser("Gal"));
            dbsubscribedUser.cleanDB();
        }