Пример #1
0
        private void set_request_context(UserHelper userHelper)
        {
            var request = new Mock<HttpRequestBase>();
            request.Setup(x => x.Cookies).Returns(new HttpCookieCollection());

            var context = new Mock<HttpContextBase>();
            context.SetupGet(x => x.Request).Returns(request.Object);

            userHelper.Context = context.Object;
        }
Пример #2
0
 private bool allowAccess(UserHelper userHelper)
 {
     if (userHelper.CurrentUserId != null)
     {
         if (_token == Privilege.Logon)
         {
             return true;
         }
         else if (_token == Privilege.Admin)
         {
             return userHelper.CurrentUser.IsAdmin;
         }
     }
     return false;
 }
Пример #3
0
 public void SetUp()
 {
     userHelper = new UserHelper();
 }