public void Get()
        {
            //Act
            var result = repository.Get(id);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(Identity));
            Assert.AreEqual(id, result.ID);
        }
        /// <summary>
        /// 获取token
        /// </summary>
        /// <returns></returns>
        public virtual TokenEntity GetToken()
        {
            var ticket = GetTokenTicket();

            if (string.IsNullOrEmpty(ticket))
            {
                return(null);
            }
            if (IdentityRepository.Get <IdentityEntity>(ticket) == null)
            {
                RemoveToken();
                RemoveTokenTimeOut();
                return(null);
            }
            if (HttpContext.Current == null)
            {
                return(null);
            }
            HttpCookie cookie = HttpContext.Current.Request.Cookies[TicketKey];

            if (cookie != null)
            {
                var token = new TokenEntity {
                    TimeOut = GetTokenTimeOut(), Ticket = cookie.Value
                };
                return(token);
            }
            return(null);
        }
 /// <summary>
 /// 得到登陆信息
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="ticket"></param>
 /// <returns></returns>
 public virtual T Get <T>(string ticket) where T : IdentityEntity
 {
     ticket = Winner.Creator.Get <ISecurity>().Decrypt3Des(ticket, DesKey);
     if (string.IsNullOrEmpty(ticket))
     {
         return(default(T));
     }
     return(IdentityRepository.Get <T>(ticket));
 }
 public virtual T Get <T>() where T : IdentityEntity
 {
     try
     {
         var ticket = GetTokenTicket();
         if (string.IsNullOrEmpty(ticket))
         {
             return(default(T));
         }
         ResetToken();
         ResetTokenTimeOut();
         return(IdentityRepository.Get <T>(ticket));
     }
     catch (Exception)
     {
         return(default(T));
     }
 }