public void Identity_AccountController_SetIdentity_Test() { string _id = "feb7ef96-d119-4f61-bdea-0a2949be270f"; string _name = "pnh"; var _identity = new GenericIdentity(_id); Console.WriteLine( String.Format("Id: {0}, Nm: {1}", _identity.GetUserId(), _identity.GetUserName())); Console.WriteLine(" "); ClaimsIdentity _claimIdentity = new ClaimsIdentity( new GenericIdentity(_name), new[] { new Claim(ClaimTypes.NameIdentifier, _id) }); var _gp = new GenericPrincipal(_claimIdentity, new string[] { "User" }); Console.WriteLine( String.Format("Id: {0}, Nm: {1}", _claimIdentity.GetUserId(), _claimIdentity.GetUserName())); Assert.AreNotEqual("", _claimIdentity.GetUserId()); Assert.AreNotEqual("", _claimIdentity.GetUserName()); }