public void userLoginForumTest() { int id1 = fm.CreateForum(titels[0]); int userId = fm.Register(userNames[0], passwords[0], emails[0], id1); Assert.AreEqual(userId, fm.Login(userNames[0], passwords[0], id1)); fm.RemoveForum(id1); }
public void UnregisteredUserLogToForumTest() { int forumId1 = fm.CreateForum(1, titels[0]); int forumId2 = fm.CreateForum(1, titels[1]); int userId = fm.Register(user[0], user[1], user[2], forumId1); Assert.IsTrue(fm.isRegisteredUser(forumId1, userId)); fm.Logout(userId, forumId1); Assert.IsFalse(fm.isLoggedUser(forumId1, userId)); try { fm.Login(user[0], user[1], forumId2); Assert.Fail("Exception was expected but not thrown. Unregistered user cannot log forum"); } catch (Exception ex) { Assert.IsFalse(fm.isLoggedUser(forumId2, userId)); } fm.UnRegister(userId, forumId1); fm.RemoveForum(1, forumId1); fm.RemoveForum(1, forumId2); }
public int Login(string username, string password, int forumId) { int userId = FM.Login(username, password, forumId); return(userId); }