public void TestForumLogin() { // arrange int userId = 1; string sessionHash = "b3ef6b3d2553fb50ef698a19567245f8"; string password = "******"; var forumRequest = new DefaultForumRequest() { IPAddress = "192.168.1.1", SessionHash = sessionHash, UserID = userId, Password = password }; // act var forumSession = new ForumUserSession(forumRequest); var forumUser = forumSession.BuildUser(); // asset Assert.IsNotNull(forumUser); }
public PartialViewResult NavBarPartial() { int userId = 0; string sessionHash = null; string password = null; if (Request.Cookies["bb_userid"] != null) { if (!Int32.TryParse(Request.Cookies["bb_userid"].Value, out userId)) { userId = 0; } } if (Request.Cookies["bb_sessionhash"] != null) { sessionHash = Request.Cookies["bb_sessionhash"].Value; } if (Request.Cookies["bb_password"] != null) { password = Request.Cookies["bb_password"].Value; } var forumRequest = new DefaultForumRequest() { IPAddress = Request.ServerVariables["REMOTE_ADDR"], SessionHash = sessionHash, UserID = userId, Password = password }; var forumSession = new ForumUserSession(forumRequest); var forumUser = forumSession.BuildUser(); return(PartialView("_NavBarPartial", forumUser)); }