private static UserInfo CreateUserContextFromUser(User user)
        {
            var userContext = new UserInfo
            {
                UserId = user.UserId,
                DisplayName = user.DisplayName,
                ClaimsIdentifier = user.AuthorizationId
            };

            return userContext;
        }
        public void WhenContextConvertedToString_ThenCanBeRecovered()
        {
            var userContext = new UserInfo()
                                  {
                                      ClaimsIdentifier = "TestClaimsIdentifier",
                                      DisplayName = "TestDisplayName",
                                      UserId = 55
                                  };

            UserInfo recoveredInfo = UserInfo.FromString(userContext.ToString());

            Assert.Equal(userContext.ClaimsIdentifier, recoveredInfo.ClaimsIdentifier);
            Assert.Equal(userContext.DisplayName, recoveredInfo.DisplayName);
            Assert.Equal(userContext.UserId, recoveredInfo.UserId);
        }
 public MileageStatsIdentity(string name, UserInfo userInfo)
     : this(name, userInfo.DisplayName, userInfo.UserId)
 {
     if (userInfo == null) throw new ArgumentNullException("userInfo");
     this.UserId = userInfo.UserId;
 }